-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1260 from brave/referrer_block-0.58.x
Issue 2252: Refactor the referrer hiding
- Loading branch information
Showing
11 changed files
with
141 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
patches/content-browser-frame_host-navigation_request.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc | ||
index 3687817b179bdc1966d136d497bef2196dcc881e..9adb66951a8ce5769b6ecdfe5625671975ceff20 100644 | ||
--- a/content/browser/frame_host/navigation_request.cc | ||
+++ b/content/browser/frame_host/navigation_request.cc | ||
@@ -1405,6 +1405,11 @@ void NavigationRequest::OnStartChecksComplete( | ||
frame_tree_node_, begin_params_.get(), &report_raw_headers); | ||
RenderFrameDevToolsAgentHost::OnNavigationRequestWillBeSent(*this); | ||
|
||
+ GetContentClient()->browser()->MaybeHideReferrer(browser_context, | ||
+ common_params_.url, | ||
+ top_document_url, | ||
+ &common_params_.referrer); | ||
+ | ||
loader_ = NavigationURLLoader::Create( | ||
browser_context->GetResourceContext(), partition, | ||
std::make_unique<NavigationRequestInfo>( |
18 changes: 18 additions & 0 deletions
18
patches/content-public-browser-content_browser_client.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h | ||
index b33545b865e4677ee2e9a909d259df171c12d985..a5d8d152dbeaf53d452c66129b47453e4ae2d20a 100644 | ||
--- a/content/public/browser/content_browser_client.h | ||
+++ b/content/public/browser/content_browser_client.h | ||
@@ -1364,6 +1364,13 @@ class CONTENT_EXPORT ContentBrowserClient { | ||
// perform additional checks, such as requiring --user-data-dir flag too to | ||
// make sure that insecure contents will not persist accidentally. | ||
virtual bool CanIgnoreCertificateErrorIfNeeded(); | ||
+ | ||
+ // Brave-speicific: allows the embedder to modify the referrer string | ||
+ // according to user preferences. | ||
+ virtual void MaybeHideReferrer(BrowserContext* browser_context, | ||
+ const GURL& request_url, | ||
+ const GURL& document_url, | ||
+ Referrer* referrer) {} | ||
}; | ||
|
||
} // namespace content |