From 188bac45b02e0b3e280369c4ed24df4556c4cc83 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Tue, 22 Dec 2020 15:23:12 -0800 Subject: [PATCH 1/3] Enable Certificate Error Assistant component (fixes brave/brave-browser#13010) --- chromium_src/components/component_updater/component_installer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/chromium_src/components/component_updater/component_installer.cc b/chromium_src/components/component_updater/component_installer.cc index 4cda24661a7c..dbd7c6397b22 100644 --- a/chromium_src/components/component_updater/component_installer.cc +++ b/chromium_src/components/component_updater/component_installer.cc @@ -23,7 +23,6 @@ void ComponentInstaller::Register(ComponentUpdateService* cus, "cmahhnpholdijhjokonmfdjbfmklppij", // Federated Learning of Cohorts "eeigpngbgcognadeebkilcpcaedhellh", // Autofill States Data "gcmjkmgdlgnkkcocmoeiminaijmmjnii", // Subresource Filter Rules - "giekcmmlnklenlaomppkphknjmnnpneh", // Certificate Error Assistant "jflookgnkcckhobaglndicnbbgbonegd", // Safety Tips "llkgjffcdpffmhiakmfcdcblohccpfmo", // Origin Trials "ojhpjlocmbogdgmfpkhlaaeamibhnphh", // Zxcvbn Data Dictionaries From f9ee1811aa0a34961d87bc673964764df336cdf7 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Tue, 22 Dec 2020 17:26:18 -0800 Subject: [PATCH 2/3] Enable Safety Tips component and feature (fixes brave/brave-browser#12999) --- app/brave_main_delegate.cc | 2 ++ app/brave_main_delegate_browsertest.cc | 2 ++ .../components/component_updater/component_installer.cc | 1 - 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index a3314e745ca7..f97b30fc6021 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -37,6 +37,7 @@ #include "components/omnibox/common/omnibox_features.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/safe_browsing/core/features.h" +#include "components/security_state/core/features.h" #include "components/sync/base/sync_base_switches.h" #include "components/translate/core/browser/translate_prefs.h" #include "components/variations/variations_switches.h" @@ -212,6 +213,7 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { #if defined(OS_WIN) features::kWinrtGeolocationImplementation.name, #endif + security_state::features::kSafetyTipUI.name, }; // Disabled features. diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index e12c44a0f805..1f25435930cb 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -18,6 +18,7 @@ #include "components/omnibox/common/omnibox_features.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/safe_browsing/core/features.h" +#include "components/security_state/core/features.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/content_features.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" @@ -89,6 +90,7 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, EnabledFeatures) { &features::kWinrtGeolocationImplementation, #endif &net::features::kLegacyTLSEnforced, + &security_state::features::kSafetyTipUI, }; for (const auto* feature : enabled_features) diff --git a/chromium_src/components/component_updater/component_installer.cc b/chromium_src/components/component_updater/component_installer.cc index dbd7c6397b22..dc09bd89c096 100644 --- a/chromium_src/components/component_updater/component_installer.cc +++ b/chromium_src/components/component_updater/component_installer.cc @@ -23,7 +23,6 @@ void ComponentInstaller::Register(ComponentUpdateService* cus, "cmahhnpholdijhjokonmfdjbfmklppij", // Federated Learning of Cohorts "eeigpngbgcognadeebkilcpcaedhellh", // Autofill States Data "gcmjkmgdlgnkkcocmoeiminaijmmjnii", // Subresource Filter Rules - "jflookgnkcckhobaglndicnbbgbonegd", // Safety Tips "llkgjffcdpffmhiakmfcdcblohccpfmo", // Origin Trials "ojhpjlocmbogdgmfpkhlaaeamibhnphh", // Zxcvbn Data Dictionaries #if defined(OS_ANDROID) From db31b77c5f4adb9e6f05cf57ca9a6a47b6e2c427 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Mon, 11 Jan 2021 20:40:26 -0800 Subject: [PATCH 3/3] Run clang-format on the brave_main_delegate files. --- app/brave_main_delegate.cc | 50 +++++++++++++------------- app/brave_main_delegate_browsertest.cc | 2 +- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index f97b30fc6021..79dc857446f6 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -83,16 +83,14 @@ const char kBraveOriginTrialsPublicKey[] = const char kDummyUrl[] = "https://no-thanks.invalid"; -BraveMainDelegate::BraveMainDelegate() - : ChromeMainDelegate() {} +BraveMainDelegate::BraveMainDelegate() : ChromeMainDelegate() {} BraveMainDelegate::BraveMainDelegate(base::TimeTicks exe_entry_point_ticks) : ChromeMainDelegate(exe_entry_point_ticks) {} BraveMainDelegate::~BraveMainDelegate() {} -content::ContentBrowserClient* -BraveMainDelegate::CreateContentBrowserClient() { +content::ContentBrowserClient* BraveMainDelegate::CreateContentBrowserClient() { #if defined(CHROME_MULTIPLE_DLL_CHILD) return NULL; #else @@ -113,8 +111,7 @@ BraveMainDelegate::CreateContentRendererClient() { #endif } -content::ContentUtilityClient* -BraveMainDelegate::CreateContentUtilityClient() { +content::ContentUtilityClient* BraveMainDelegate::CreateContentUtilityClient() { #if defined(CHROME_MULTIPLE_DLL_BROWSER) return NULL; #else @@ -132,19 +129,19 @@ void BraveMainDelegate::PreSandboxStartup() { #if defined(OS_MAC) base::PathService::Get(base::DIR_APP_DATA, &chrome_user_data_dir); chrome_user_data_dir = chrome_user_data_dir.Append("Google/Chrome"); - native_messaging_dir = base::FilePath(FILE_PATH_LITERAL( - "/Library/Google/Chrome/NativeMessagingHosts")); + native_messaging_dir = base::FilePath( + FILE_PATH_LITERAL("/Library/Google/Chrome/NativeMessagingHosts")); #else chrome::GetDefaultUserDataDirectory(&chrome_user_data_dir); - native_messaging_dir = base::FilePath(FILE_PATH_LITERAL( - "/etc/opt/chrome/native-messaging-hosts")); + native_messaging_dir = base::FilePath( + FILE_PATH_LITERAL("/etc/opt/chrome/native-messaging-hosts")); #endif // defined(OS_MAC) base::PathService::OverrideAndCreateIfNeeded( chrome::DIR_USER_NATIVE_MESSAGING, chrome_user_data_dir.Append(FILE_PATH_LITERAL("NativeMessagingHosts")), false, true); - base::PathService::OverrideAndCreateIfNeeded(chrome::DIR_NATIVE_MESSAGING, - native_messaging_dir, false, true); + base::PathService::OverrideAndCreateIfNeeded( + chrome::DIR_NATIVE_MESSAGING, native_messaging_dir, false, true); #endif // defined(OS_LINUX) || defined(OS_MAC) #if defined(OS_POSIX) && !defined(OS_MAC) @@ -169,10 +166,11 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { // Setting these to default values in Chromium to maintain parity // See: ChromeContentVerifierDelegate::GetDefaultMode for ContentVerification // See: GetStatus in install_verifier.cc for InstallVerification - command_line.AppendSwitchASCII(switches::kExtensionContentVerification, + command_line.AppendSwitchASCII( + switches::kExtensionContentVerification, switches::kExtensionContentVerificationEnforceStrict); command_line.AppendSwitchASCII(switches::kExtensionsInstallVerification, - "enforce"); + "enforce"); if (!base::CommandLine::ForCurrentProcess()->HasSwitch( embedder_support::kOriginTrialPublicKey)) { @@ -195,25 +193,25 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { // Brave variations std::string kVariationsServerURL = BRAVE_VARIATIONS_SERVER_URL; command_line.AppendSwitchASCII(variations::switches::kVariationsServerURL, - kVariationsServerURL.c_str()); + kVariationsServerURL.c_str()); CHECK(!kVariationsServerURL.empty()); #endif // Enabled features. std::unordered_set enabled_features = { - // Upgrade all mixed content - blink::features::kMixedContentAutoupgrade.name, - password_manager::features::kPasswordImport.name, - net::features::kLegacyTLSEnforced.name, - // Enable webui dark theme: @media (prefers-color-scheme: dark) is gated - // on this feature. - features::kWebUIDarkMode.name, - blink::features::kPrefetchPrivacyChanges.name, - blink::features::kReducedReferrerGranularity.name, + // Upgrade all mixed content + blink::features::kMixedContentAutoupgrade.name, + password_manager::features::kPasswordImport.name, + net::features::kLegacyTLSEnforced.name, + // Enable webui dark theme: @media (prefers-color-scheme: dark) is gated + // on this feature. + features::kWebUIDarkMode.name, + blink::features::kPrefetchPrivacyChanges.name, + blink::features::kReducedReferrerGranularity.name, #if defined(OS_WIN) - features::kWinrtGeolocationImplementation.name, + features::kWinrtGeolocationImplementation.name, #endif - security_state::features::kSafetyTipUI.name, + security_state::features::kSafetyTipUI.name, }; // Disabled features. diff --git a/app/brave_main_delegate_browsertest.cc b/app/brave_main_delegate_browsertest.cc index 1f25435930cb..e352d072ae77 100644 --- a/app/brave_main_delegate_browsertest.cc +++ b/app/brave_main_delegate_browsertest.cc @@ -21,13 +21,13 @@ #include "components/security_state/core/features.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/content_features.h" -#include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "content/public/test/browser_test.h" #include "gpu/config/gpu_finch_features.h" #include "net/base/features.h" #include "services/device/public/cpp/device_features.h" #include "services/network/public/cpp/features.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/web_preferences/web_preferences.h" using BraveMainDelegateBrowserTest = InProcessBrowserTest;