Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd social blocking options #1818
Conversation
3c25dd3
to
e4bc0dc
aa7de48
to
b175246
| @@ -163,7 +183,6 @@ void AdBlockBaseService::OnDATFileDataReady() { | |||
| LOG(ERROR) << "Could not obtain ad block data"; | |||
| return; | |||
| } | |||
| ad_block_client_.reset(new AdBlockClient()); | |||
This comment has been minimized.
This comment has been minimized.
bbondy
Mar 11, 2019
Author
Member
This would remove the already added tags on the instance. Deserialize should already be resetting all members to a valid state.
c5a9534
to
e6a4f5c
| @@ -1,7 +1,7 @@ | |||
| use_relative_paths = True | |||
|
|
|||
| deps = { | |||
| "vendor/ad-block": "https://github.com/brave/ad-block.git@534c153a3e8d1c8eda02cc80297b9abf87e9a7da", | |||
| "vendor/ad-block": "https://github.com/brave/ad-block.git@8ddfa911aeaf044741a9d5b66ddd84c9a3c352e7", | |||
This comment has been minimized.
This comment has been minimized.
| RegisterBooleanPref(kGoogleLoginControlType, true); | ||
| builder.SetPrefService(std::move(prefs)); | ||
| return builder.Build().release(); | ||
| } |
This comment has been minimized.
This comment has been minimized.
bbondy
Mar 12, 2019
Author
Member
This was needed otherwise a new unregistered pref error occurs only for 1 test in this file.
| @@ -167,7 +168,8 @@ bool BraveContentBrowserClient::AllowAccessCookie( | |||
| content_settings::BraveCookieSettings* cookie_settings = | |||
| (content_settings::BraveCookieSettings*)io_data->GetCookieSettings(); | |||
| bool allow = !ShouldBlockCookie(allow_brave_shields, allow_1p_cookies, | |||
| allow_3p_cookies, first_party, url) && | |||
| allow_3p_cookies, first_party, url, | |||
| cookie_settings->GetAllowGoogleAuth()) && | |||
This comment has been minimized.
This comment has been minimized.
bbondy
Mar 12, 2019
Author
Member
ShouldBlockCookie will need a refactor but not in the scope of this issue.
This comment has been minimized.
This comment has been minimized.
| @@ -47,6 +47,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | |||
| // Default Brave shields | |||
| registry->RegisterBooleanPref(kHTTPSEVerywhereControlType, true); | |||
| registry->RegisterBooleanPref(kNoScriptControlType, false); | |||
| registry->RegisterBooleanPref(kGoogleLoginControlType, true); | |||
This comment has been minimized.
This comment has been minimized.
bbondy
Mar 12, 2019
•
Author
Member
This is the only thing that actually changes default behaviour in the context of this ticket.
| kTwitterEmbedControlType, | ||
| base::Bind(&BraveNetworkDelegateBase::OnPreferenceChanged, | ||
| base::Unretained(this), kTwitterEmbedControlType)); | ||
| user_pref_change_registrar_->Add( |
This comment has been minimized.
This comment has been minimized.
bbondy
Mar 12, 2019
Author
Member
I first tried adding these observers inside of the ad block base class but it caused problems because of threading, it doesn't work from the main thread which prefs needed to.
| #include "brave/components/brave_shields/common/brave_shield_constants.h" | ||
| #include "brave/common/brave_cookie_blocking.h" | ||
| #include "brave/common/pref_names.h" | ||
| #include "components/prefs/pref_service.h" |
This comment has been minimized.
This comment has been minimized.
| @@ -29,6 +30,13 @@ index 65d9633a7c0e4b0b44dd8a0ae2bb7598b3ee1b06..c6a6980abc74d80c8d3b8fa9104c6494 | |||
| + <settings-default-brave-shields-page prefs="{{prefs}}"></settings-default-brave-shields-page> | |||
| + </settings-section> | |||
| + </template> | |||
| + <template is="dom-if" if="[[showPage_(pageVisibility.socialBlocking)]]" | |||
This comment has been minimized.
This comment has been minimized.
| /** | ||
| * @implements {settings.SocialBlockingBrowserProxy} | ||
| */ | ||
| class DefaultBraveShieldsBrowserProxyImpl { |
This comment has been minimized.
This comment has been minimized.
| class DefaultBraveShieldsBrowserProxyImpl { | ||
| } | ||
|
|
||
| cr.addSingletonGetter(DefaultBraveShieldsBrowserProxyImpl); |
This comment has been minimized.
This comment has been minimized.
| const std::string& pref_name) { | ||
| DCHECK_CURRENTLY_ON(BrowserThread::UI); | ||
| PrefService* user_prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | ||
| allow_google_auth_ = user_prefs->GetBoolean(kGoogleLoginControlType); |
This comment has been minimized.
This comment has been minimized.
iefremov
Jul 21, 2019
Contributor
it is not thread-safe to write allow_google_auth_ on UI and later read on IO
bbondy commentedMar 1, 2019
•
edited
Fix brave/brave-browser#3489
Fix brave/brave-browser#3534
Related PRs:
brave/adblock-lists#54
brave/ad-block#192
The only default behaviour that this PR changes is that a cookie for Google login buttons is now allowed. It adds an option to be able to disable it though.
It also adds 3 options to be able to disable previously always-allowed things (Facebook, Twitter, LinkedIn embeds and login buttons).
It looks like this:

Test plan is in the issue.
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests) onnpm run lint)git rebase master(if needed).git rebase -ito squash commits (if needed).Test Plan:
Reviewer Checklist: