-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 3650: Enable google sign in for extensions
- Loading branch information
Showing
13 changed files
with
182 additions
and
25 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
55 changes: 55 additions & 0 deletions
55
browser/ui/webui/settings/brave_social_blocking_handler.cc
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,55 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/ui/webui/settings/brave_social_blocking_handler.h" | ||
|
||
#include <string> | ||
|
||
#include "base/bind.h" | ||
#include "base/values.h" | ||
#include "brave/browser/brave_browser_process_impl.h" | ||
#include "brave/common/pref_names.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/browser/lifetime/application_lifetime.h" | ||
#include "chrome/browser/ui/browser.h" | ||
#include "chrome/browser/ui/browser_finder.h" | ||
#include "chrome/browser/ui/browser_window.h" | ||
#include "chrome/common/chrome_switches.h" | ||
#include "chrome/common/pref_names.h" | ||
#include "components/prefs/pref_service.h" | ||
#include "content/public/browser/web_ui.h" | ||
#include "content/public/browser/web_ui_data_source.h" | ||
|
||
BraveSocialBlockingHandler::BraveSocialBlockingHandler() | ||
: weak_ptr_factory_(this) { | ||
} | ||
|
||
BraveSocialBlockingHandler::~BraveSocialBlockingHandler() { | ||
} | ||
|
||
void BraveSocialBlockingHandler::RegisterMessages() { | ||
profile_ = Profile::FromWebUI(web_ui()); | ||
web_ui()->RegisterMessageCallback( | ||
"setGoogleLoginEnabled", | ||
base::BindRepeating(&BraveSocialBlockingHandler::SetGoogleLoginEnabled, | ||
base::Unretained(this))); | ||
} | ||
|
||
void BraveSocialBlockingHandler::SetGoogleLoginEnabled( | ||
const base::ListValue* args) { | ||
CHECK_EQ(args->GetSize(), 1U); | ||
CHECK(profile_); | ||
bool enabled; | ||
args->GetBoolean(0, &enabled); | ||
|
||
profile_->GetPrefs()->SetBoolean(prefs::kSigninAllowedOnNextStartup, enabled); | ||
} | ||
|
||
// static | ||
void BraveSocialBlockingHandler::AddLoadTimeData(content::WebUIDataSource* data_source, | ||
Profile* profile) { | ||
data_source->AddBoolean("googleLoginEnabledAtStartup", | ||
profile->GetPrefs()->GetBoolean(prefs::kSigninAllowedOnNextStartup)); | ||
} |
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,43 @@ | ||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_SOCIAL_BLOCKING_HANDLER_H_ | ||
#define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_SOCIAL_BLOCKING_HANDLER_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/memory/weak_ptr.h" | ||
#include "brave/browser/tor/buildflags.h" | ||
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | ||
#include "chrome/common/extensions/webstore_install_result.h" | ||
#include "components/prefs/pref_change_registrar.h" | ||
|
||
class Profile; | ||
|
||
namespace content { | ||
class WebUIDataSource; | ||
} | ||
|
||
class BraveSocialBlockingHandler : public settings::SettingsPageUIHandler { | ||
public: | ||
BraveSocialBlockingHandler(); | ||
~BraveSocialBlockingHandler() override; | ||
static void AddLoadTimeData(content::WebUIDataSource* data_source, | ||
Profile* profile); | ||
|
||
private: | ||
void RegisterMessages() override; | ||
void OnJavascriptAllowed() override {} | ||
void OnJavascriptDisallowed() override {} | ||
|
||
void SetGoogleLoginEnabled(const base::ListValue* args); | ||
|
||
Profile* profile_ = nullptr; | ||
base::WeakPtrFactory<BraveSocialBlockingHandler> weak_ptr_factory_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(BraveSocialBlockingHandler); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_SOCIAL_BLOCKING_HANDLER_H_ |
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
15 changes: 0 additions & 15 deletions
15
patches/chrome-browser-signin-account_consistency_mode_manager.cc.patch
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
patches/chrome-browser-ui-startup-bad_flags_prompt.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,12 @@ | ||
diff --git a/chrome/browser/ui/startup/bad_flags_prompt.cc b/chrome/browser/ui/startup/bad_flags_prompt.cc | ||
index 7803de645e87d0b3fd4c7d50f843f467269077f0..5d46c1756aae719f02acc688bed5d4ae26803afe 100644 | ||
--- a/chrome/browser/ui/startup/bad_flags_prompt.cc | ||
+++ b/chrome/browser/ui/startup/bad_flags_prompt.cc | ||
@@ -79,7 +79,6 @@ static const char* kBadFlags[] = { | ||
switches::kIgnoreCertificateErrors, | ||
|
||
// These flags change the URLs that handle PII. | ||
- switches::kGaiaUrl, | ||
translate::switches::kTranslateScriptURL, | ||
|
||
#if BUILDFLAG(ENABLE_EXTENSIONS) |