Skip to content

Commit

Permalink
Merge pull request #7521 from brave/enable-security-components
Browse files Browse the repository at this point in the history
Enable security components
  • Loading branch information
fmarier authored Jan 13, 2021
2 parents 619e551 + db31b77 commit ffc31d7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
50 changes: 25 additions & 25 deletions app/brave_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -82,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
Expand All @@ -112,8 +111,7 @@ BraveMainDelegate::CreateContentRendererClient() {
#endif
}

content::ContentUtilityClient*
BraveMainDelegate::CreateContentUtilityClient() {
content::ContentUtilityClient* BraveMainDelegate::CreateContentUtilityClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return NULL;
#else
Expand All @@ -131,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)
Expand All @@ -168,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)) {
Expand All @@ -194,24 +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<const char*> 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,
};

// Disabled features.
Expand Down
4 changes: 3 additions & 1 deletion app/brave_main_delegate_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
#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"
#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;

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +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
#if defined(OS_ANDROID)
Expand Down

0 comments on commit ffc31d7

Please sign in to comment.