diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 6d356bb740a6..9ddc25d57a81 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -401,7 +401,7 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Show the number of blocked items on the Shields icon - Allow Google login for extensions and third party sites + Allow Google login buttons on third party sites Allow Facebook logins and embedded posts @@ -653,6 +653,9 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Load Crypto Wallets on startup + + Allow Google login for extensions + Uses Hangouts component to enable screen sharing and other features in the browser. diff --git a/browser/brave_profile_prefs_browsertest.cc b/browser/brave_profile_prefs_browsertest.cc index 87745d49cf87..deecbf207d33 100644 --- a/browser/brave_profile_prefs_browsertest.cc +++ b/browser/brave_profile_prefs_browsertest.cc @@ -124,7 +124,7 @@ IN_PROC_BROWSER_TEST_F(BraveProfilePrefsBrowserTest, EXPECT_EQ(browser()->profile()->GetPrefs()->GetInteger( prefs::kNetworkPredictionOptions), chrome_browser_net::NETWORK_PREDICTION_NEVER); - EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean( + EXPECT_FALSE(browser()->profile()->GetPrefs()->GetBoolean( prefs::kSigninAllowedOnNextStartup)); // Verify cloud print is disabled. EXPECT_FALSE(browser()->profile()->GetPrefs()->GetBoolean( diff --git a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_browser_proxy.js b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_browser_proxy.js index 749f16c3fa18..3777c5c9111b 100644 --- a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_browser_proxy.js +++ b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_browser_proxy.js @@ -21,6 +21,7 @@ cr.define('settings', function() { isTorManaged() {} getRestartNeeded() {} getWeb3ProviderList() {} + wasSignInEnabledAtStartup() {} } /** @@ -59,6 +60,9 @@ cr.define('settings', function() { getWeb3ProviderList() { return new Promise(resolve => chrome.braveWallet.getWeb3ProviderList(resolve)) } + wasSignInEnabledAtStartup() { + return loadTimeData.getBoolean('signInAllowedOnNextStartupInitialValue'); + } } cr.addSingletonGetter(BraveDefaultExtensionsBrowserProxyImpl); diff --git a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html index 9330ad61f15f..eab041aa9c02 100644 --- a/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html +++ b/browser/resources/settings/brave_default_extensions_page/brave_default_extensions_page.html @@ -78,6 +78,18 @@ pref="{{prefs.brave.wallet.load_on_startup}}" label="$i18n{loadCryptoWalletsOnStartupDesc}"> + + + - - diff --git a/browser/resources/settings/social_blocking_page/social_blocking_page.js b/browser/resources/settings/social_blocking_page/social_blocking_page.js index 2db9226fa55b..c11877e20b59 100644 --- a/browser/resources/settings/social_blocking_page/social_blocking_page.js +++ b/browser/resources/settings/social_blocking_page/social_blocking_page.js @@ -7,34 +7,5 @@ * social blocking options */ Polymer({ - is: 'settings-social-blocking-page', - - properties: {}, - - /** @private {?settings.SocialBlockingPageProxy} */ - browserProxy_: null, - - /** @override */ - created: function() { - this.browserProxy_ = settings.SocialBlockingPageProxyImpl.getInstance(); - }, - - /** @override */ - ready: function() { - this.shouldShowRestart_ = this.shouldShowRestart_.bind(this) - this.restartBrowser_ = this.restartBrowser_.bind(this) - }, - - shouldShowRestart_: function(value) { - return this.browserProxy_.wasSignInEnabledAtStartup() != value; - }, - - setSignInEnabledAtNextStartup_: function() { - this.browserProxy_.setSignInEnabledAtNextStartup(this.$.googleLoginControlType.checked); - }, - - restartBrowser_: function(e) { - e.stopPropagation(); - window.open("chrome://restart", "_self"); - }, + is: 'settings-social-blocking-page' }); diff --git a/browser/resources/settings/social_blocking_page/social_blocking_page_proxy.html b/browser/resources/settings/social_blocking_page/social_blocking_page_proxy.html deleted file mode 100644 index 76dc9c2e55fc..000000000000 --- a/browser/resources/settings/social_blocking_page/social_blocking_page_proxy.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/browser/resources/settings/social_blocking_page/social_blocking_page_proxy.js b/browser/resources/settings/social_blocking_page/social_blocking_page_proxy.js deleted file mode 100644 index 4981e84c5c5d..000000000000 --- a/browser/resources/settings/social_blocking_page/social_blocking_page_proxy.js +++ /dev/null @@ -1,43 +0,0 @@ -/* 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/. */ - -// clang-format off -// #import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; -// clang-format on - -cr.define('settings', function() { - /** @interface */ - class SocialBlockingPageProxy { - /** - * @param {boolean} enabled (true/false). - */ - setSignInEnabledAtNextStartup(value) {} - /** - * @return {boolean} - */ - wasSignInEnabledAtStartup() {} - } - - /** - * @implements {settings.SocialBlockingPageProxy} - */ - /* #export */ class SocialBlockingPageProxyImpl { - setSignInEnabledAtNextStartup(value) { - chrome.settingsPrivate.setPref('signin.allowed_on_next_startup', value); - } - - wasSignInEnabledAtStartup() { - return loadTimeData.getBoolean('signInAllowedOnNextStartupInitialValue'); - } - } - - cr.addSingletonGetter(SocialBlockingPageProxyImpl); - - // #cr_define_end - return { - SocialBlockingPageProxy: SocialBlockingPageProxy, - SocialBlockingPageProxyImpl: SocialBlockingPageProxyImpl, - }; -}); diff --git a/browser/ui/views/profiles/brave_profile_menu_view.cc b/browser/ui/views/profiles/brave_profile_menu_view.cc index 792a8edfdf5c..bbc5f0a4348f 100644 --- a/browser/ui/views/profiles/brave_profile_menu_view.cc +++ b/browser/ui/views/profiles/brave_profile_menu_view.cc @@ -9,10 +9,16 @@ #include #include "brave/browser/profiles/profile_util.h" +#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_attributes_entry.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_window.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/grit/generated_resources.h" +#include "components/vector_icons/vector_icons.h" +#include "ui/base/l10n/l10n_util.h" void BraveProfileMenuView::BuildIdentity() { ProfileMenuView::BuildIdentity(); @@ -33,6 +39,22 @@ void BraveProfileMenuView::BuildAutofillButtons() {} // We don't want to show any Chromium sync info. void BraveProfileMenuView::BuildSyncInfo() {} +// We don't want feature buttons to manage google account +void BraveProfileMenuView::BuildFeatureButtons() { + Profile* profile = browser()->profile(); + int window_count = chrome::GetBrowserCount(profile); + if (!profile->IsOffTheRecord() && profile->HasPrimaryOTRProfile()) + window_count += chrome::GetBrowserCount(profile->GetPrimaryOTRProfile()); + if (window_count > 1) { + AddFeatureButton( + l10n_util::GetPluralStringFUTF16(IDS_PROFILES_CLOSE_X_WINDOWS_BUTTON, + window_count), + base::BindRepeating(&ProfileMenuView::OnExitProfileButtonClicked, + base::Unretained(this)), + vector_icons::kCloseIcon); + } +} + gfx::ImageSkia BraveProfileMenuView::GetSyncIcon() const { // We don't need sync overlay. return gfx::ImageSkia(); diff --git a/browser/ui/views/profiles/brave_profile_menu_view.h b/browser/ui/views/profiles/brave_profile_menu_view.h index e7c0b82b7d0b..41ba0ea0c9a9 100644 --- a/browser/ui/views/profiles/brave_profile_menu_view.h +++ b/browser/ui/views/profiles/brave_profile_menu_view.h @@ -22,6 +22,7 @@ class BraveProfileMenuView : public ProfileMenuView { void BuildIdentity() override; void BuildAutofillButtons() override; void BuildSyncInfo() override; + void BuildFeatureButtons() override; gfx::ImageSkia GetSyncIcon() const override; DISALLOW_COPY_AND_ASSIGN(BraveProfileMenuView); diff --git a/chromium_src/chrome/browser/profiles/gaia_info_update_service.cc b/chromium_src/chrome/browser/profiles/gaia_info_update_service.cc new file mode 100644 index 000000000000..5d361539ab4b --- /dev/null +++ b/chromium_src/chrome/browser/profiles/gaia_info_update_service.cc @@ -0,0 +1,15 @@ +/* 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/. */ + +#include "chrome/browser/profiles/gaia_info_update_service.h" + +#define ShouldUseGAIAProfileInfo ShouldUseGAIAProfileInfo_ChromiumImpl +#include "../../../../../chrome/browser/profiles/gaia_info_update_service.cc" +#undef ShouldUseGAIAProfileInfo + +// static +bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { + return false; +} diff --git a/chromium_src/chrome/browser/profiles/gaia_info_update_service.h b/chromium_src/chrome/browser/profiles/gaia_info_update_service.h new file mode 100644 index 000000000000..d37d25df6182 --- /dev/null +++ b/chromium_src/chrome/browser/profiles/gaia_info_update_service.h @@ -0,0 +1,15 @@ +/* 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_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_ + +#define ShouldUseGAIAProfileInfo \ + ShouldUseGAIAProfileInfo_ChromiumImpl(Profile* profile); \ + static bool ShouldUseGAIAProfileInfo +#include "../../../../../chrome/browser/profiles/gaia_info_update_service.h" +#undef ShouldUseGAIAProfileInfo + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_GAIA_INFO_UPDATE_SERVICE_H_ diff --git a/chromium_src/chrome/browser/profiles/pref_service_builder_utils.cc b/chromium_src/chrome/browser/profiles/pref_service_builder_utils.cc index 420852fed00d..5f5586facaca 100644 --- a/chromium_src/chrome/browser/profiles/pref_service_builder_utils.cc +++ b/chromium_src/chrome/browser/profiles/pref_service_builder_utils.cc @@ -40,6 +40,9 @@ void RegisterProfilePrefs(bool is_signin_profile, // Disable spell check service registry->SetDefaultPrefValue( spellcheck::prefs::kSpellCheckUseSpellingService, base::Value(false)); + + registry->SetDefaultPrefValue(prefs::kSigninAllowedOnNextStartup, + base::Value(false)); #if defined(OS_LINUX) // Use brave theme by default instead of gtk theme. registry->SetDefaultPrefValue(prefs::kUsesSystemTheme, base::Value(false)); diff --git a/chromium_src/chrome/browser/profiles/profiles_state.cc b/chromium_src/chrome/browser/profiles/profiles_state.cc index 911f1b35cf78..bb52c7d4addf 100644 --- a/chromium_src/chrome/browser/profiles/profiles_state.cc +++ b/chromium_src/chrome/browser/profiles/profiles_state.cc @@ -6,6 +6,7 @@ #include "brave/browser/profiles/brave_profile_manager.h" #include "brave/browser/profiles/profile_util.h" #include "ui/gfx/text_elider.h" + #define GetAvatarNameForProfile GetAvatarNameForProfile_ChromiumImpl #include "../../../../../chrome/browser/profiles/profiles_state.cc" #undef GetAvatarNameForProfile diff --git a/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button.h b/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button.h index e0180dcdf410..60812c0d8568 100644 --- a/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button.h +++ b/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button.h @@ -7,7 +7,9 @@ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_ #define GetAvatarIcon virtual GetAvatarIcon +#define AvatarToolbarButtonDelegate BraveAvatarToolbarButtonDelegate #include "../../../../../../../chrome/browser/ui/views/profiles/avatar_toolbar_button.h" +#undef AvatarToolbarButtonDelegate #undef GetAvatarIcon #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_ diff --git a/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc b/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc index 4298edfd51be..183e31f17d5d 100644 --- a/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc +++ b/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc @@ -31,3 +31,6 @@ AvatarToolbarButton::State BraveAvatarToolbarButtonDelegate::GetState() const { return state; } +gfx::Image BraveAvatarToolbarButtonDelegate::GetGaiaAccountImage() const { + return gfx::Image(); +} diff --git a/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h b/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h index 55444c1b15f9..0ea575e9df10 100644 --- a/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h +++ b/chromium_src/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h @@ -33,6 +33,7 @@ class BraveAvatarToolbarButtonDelegate : public AvatarToolbarButtonDelegate { ~BraveAvatarToolbarButtonDelegate() override = default; void Init(AvatarToolbarButton* button, Profile* profile) override; + gfx::Image GetGaiaAccountImage() const; AvatarToolbarButton::State GetState() const override; private: diff --git a/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view.h b/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view.h index 42bc668fb249..67a9b0109a48 100644 --- a/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view.h +++ b/chromium_src/chrome/browser/ui/views/profiles/profile_menu_view.h @@ -13,8 +13,10 @@ #define BuildAutofillButtons virtual BuildAutofillButtons #define BuildIdentity virtual BuildIdentity #define BuildSyncInfo virtual BuildSyncInfo +#define BuildFeatureButtons virtual BuildFeatureButtons #include "../../../../../../../chrome/browser/ui/views/profiles/profile_menu_view.h" +#undef BuildFeatureButtons #undef BuildSyncInfo #undef BuildIdentity #undef BuildAutofillButtons diff --git a/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 87a25e2c95e9..1389254bd8d7 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc @@ -46,7 +46,7 @@ const char kBraveReleaseTagPrefix[] = "https://github.com/brave/brave-browser/releases/tag/v"; const char kGoogleLoginLearnMoreURL[] = "https://github.com/brave/brave-browser/wiki/" - "Social-Blocking:-Allow-Google-login"; + "Allow-Google-login---Third-Parties-and-Extensions"; void BraveAddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) { @@ -267,6 +267,8 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source, IDS_SETTINGS_BRAVE_WEB3_PROVIDER_DESC}, {"loadCryptoWalletsOnStartupDesc", IDS_SETTINGS_LOAD_CRYPTO_WALLETS_ON_STARTUP}, + {"googleLoginForExtensionsDesc", + IDS_SETTINGS_GOOGLE_LOGIN_FOR_EXTENSIONS}, {"hangoutsEnabledDesc", IDS_SETTINGS_HANGOUTS_ENABLED_DESC}, {"ipfsCompanionEnabledDesc",