From 253ed36f3c0b81bd5546d938b54abd2066281142 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Tue, 19 Nov 2019 23:48:58 -0700 Subject: [PATCH 1/3] Remote debugging can now be enabled via brave://settings/privacy Default for this is FALSE (meaning remote debugging is disabled). Setting is global (using local_state), not per-profile. Fixes https://github.com/brave/brave-browser/issues/5640 Fixes https://github.com/brave/brave-browser/issues/3199 --- app/brave_generated_resources.grd | 4 +++ browser/brave_local_state_prefs.cc | 6 ++-- .../brave_personalization_options.html | 6 ++++ .../brave_personalization_options.js | 12 +++++-- .../brave_privacy_page_browser_proxy.js | 21 +++++++++--- .../webui/settings/brave_privacy_handler.cc | 33 ++++++++++++++++++- .../ui/webui/settings/brave_privacy_handler.h | 3 ++ .../browser/devtools/devtools_ui_bindings.cc | 26 +++++++++++++++ .../browser/devtools/devtools_ui_bindings.h | 15 +++++++++ .../settings_localized_strings_provider.cc | 4 ++- common/pref_names.cc | 1 + common/pref_names.h | 1 + ...-ui-webui-devtools_ui_data_source.cc.patch | 12 ------- 13 files changed, 122 insertions(+), 22 deletions(-) create mode 100644 chromium_src/chrome/browser/devtools/devtools_ui_bindings.cc create mode 100644 chromium_src/chrome/browser/devtools/devtools_ui_bindings.h delete mode 100644 patches/chrome-browser-ui-webui-devtools_ui_data_source.cc.patch diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 32d64d561f11..9f7f7b6a0b6d 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -393,6 +393,10 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Use Google Services for Push Messaging + + + Remote debugging + Sync diff --git a/browser/brave_local_state_prefs.cc b/browser/brave_local_state_prefs.cc index 440adb6b79dd..44550b3db815 100644 --- a/browser/brave_local_state_prefs.cc +++ b/browser/brave_local_state_prefs.cc @@ -9,13 +9,14 @@ #include "brave/browser/brave_stats_updater.h" #include "brave/browser/metrics/metrics_reporting_util.h" #include "brave/browser/tor/buildflags.h" +#include "brave/common/pref_names.h" #include "brave/components/brave_referrals/buildflags/buildflags.h" #include "brave/components/brave_shields/browser/ad_block_service.h" #include "brave/components/brave_shields/browser/brave_shields_p3a.h" -#include "brave/components/p3a/buildflags.h" #include "brave/components/p3a/brave_p3a_service.h" -#include "chrome/common/pref_names.h" +#include "brave/components/p3a/buildflags.h" #include "chrome/browser/first_run/first_run.h" +#include "chrome/common/pref_names.h" #include "components/metrics/metrics_pref_names.h" #include "components/prefs/pref_registry_simple.h" #include "third_party/widevine/cdm/buildflags.h" @@ -41,6 +42,7 @@ namespace brave { void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { brave_shields::RegisterPrefsForAdBlockService(registry); RegisterPrefsForBraveStatsUpdater(registry); + registry->RegisterBooleanPref(kRemoteDebuggingEnabled, false); #if BUILDFLAG(ENABLE_BRAVE_REFERRALS) RegisterPrefsForBraveReferralsService(registry); #endif diff --git a/browser/resources/settings/brave_privacy_page/brave_personalization_options.html b/browser/resources/settings/brave_privacy_page/brave_personalization_options.html index 35409d3124eb..937704298863 100644 --- a/browser/resources/settings/brave_privacy_page/brave_personalization_options.html +++ b/browser/resources/settings/brave_privacy_page/brave_personalization_options.html @@ -48,6 +48,12 @@ + + diff --git a/browser/resources/settings/brave_privacy_page/brave_personalization_options.js b/browser/resources/settings/brave_privacy_page/brave_personalization_options.js index 1d1ecd4c69dd..3707ec292388 100644 --- a/browser/resources/settings/brave_privacy_page/brave_personalization_options.js +++ b/browser/resources/settings/brave_privacy_page/brave_personalization_options.js @@ -23,7 +23,8 @@ Polymer({ }, webRTCPolicy_: String, - p3aEnabled_: Boolean + p3aEnabled_: Boolean, + remoteDebuggingEnabled_: Boolean }, /** @private {?settings.BravePrivacyBrowserProxy} */ @@ -46,6 +47,9 @@ Polymer({ this.browserProxy_.getP3AEnabled().then(enabled => { this.p3aEnabled_ = enabled; }); + this.browserProxy_.getRemoteDebuggingEnabled().then(enabled => { + this.remoteDebuggingEnabled_ = enabled; + }); }, /** @@ -65,7 +69,11 @@ Polymer({ onP3AEnabledChange_: function() { this.browserProxy_.setP3AEnabled(this.$.p3aEnabled.checked); }, - + + onRemoteDebuggingEnabledChange_: function() { + this.browserProxy_.setRemoteDebuggingEnabled(this.$.remoteDebuggingEnabled.checked); + }, + shouldShowRestart_: function(enabled) { return enabled != this.browserProxy_.wasPushMessagingEnabledAtStartup(); }, diff --git a/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.js b/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.js index 0d63ababbe6a..10d3e0c1ddd2 100644 --- a/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.js +++ b/browser/resources/settings/brave_privacy_page/brave_privacy_page_browser_proxy.js @@ -21,6 +21,14 @@ cr.define('settings', function() { * @param {boolean} enabled (true/false). */ setP3AEnabled(value) {} + /** + * @return {!Promise} + */ + getRemoteDebuggingEnabled() {} + /** + * @param {boolean} enabled (true/false). + */ + setRemoteDebuggingEnabled(value) {} /** * @return {boolean} */ @@ -31,26 +39,31 @@ cr.define('settings', function() { * @implements {settings.BravePrivacyBrowserProxy} */ class BravePrivacyBrowserProxyImpl { - /** @override */ + /** @overrides */ getWebRTCPolicy() { return cr.sendWithPromise('getWebRTCPolicy'); } - /** @override */ setWebRTCPolicy(policy) { chrome.send('setWebRTCPolicy', [policy]); } - /** @override */ getP3AEnabled() { return cr.sendWithPromise('getP3AEnabled'); } - /** @override */ setP3AEnabled(value) { chrome.send('setP3AEnabled', [value]) } + getRemoteDebuggingEnabled() { + return cr.sendWithPromise('getRemoteDebuggingEnabled'); + } + + setRemoteDebuggingEnabled(value) { + chrome.send('setRemoteDebuggingEnabled', [value]) + } + wasPushMessagingEnabledAtStartup() { return loadTimeData.getBoolean('pushMessagingEnabledAtStartup'); } diff --git a/browser/ui/webui/settings/brave_privacy_handler.cc b/browser/ui/webui/settings/brave_privacy_handler.cc index 668efe47a67e..b9bcd49ba746 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.cc +++ b/browser/ui/webui/settings/brave_privacy_handler.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/values.h" +#include "brave/common/pref_names.h" #include "brave/components/p3a/pref_names.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" @@ -16,8 +17,8 @@ #include "components/gcm_driver/gcm_buildflags.h" #include "components/prefs/pref_service.h" #include "content/public/browser/web_ui.h" -#include "content/public/common/webrtc_ip_handling_policy.h" #include "content/public/browser/web_ui_data_source.h" +#include "content/public/common/webrtc_ip_handling_policy.h" #if !BUILDFLAG(USE_GCM_FROM_PLATFORM) #include "brave/browser/gcm_driver/brave_gcm_channel_status.h" @@ -40,6 +41,14 @@ void BravePrivacyHandler::RegisterMessages() { web_ui()->RegisterMessageCallback( "getP3AEnabled", base::BindRepeating(&BravePrivacyHandler::GetP3AEnabled, base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "setRemoteDebuggingEnabled", + base::BindRepeating(&BravePrivacyHandler::SetRemoteDebuggingEnabled, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "getRemoteDebuggingEnabled", + base::BindRepeating(&BravePrivacyHandler::GetRemoteDebuggingEnabled, + base::Unretained(this))); } // static @@ -97,3 +106,25 @@ void BravePrivacyHandler::GetP3AEnabled(const base::ListValue* args) { AllowJavascript(); ResolveJavascriptCallback(args->GetList()[0].Clone(), base::Value(enabled)); } + +void BravePrivacyHandler::SetRemoteDebuggingEnabled( + const base::ListValue* args) { + CHECK_EQ(args->GetSize(), 1U); + + bool enabled; + args->GetBoolean(0, &enabled); + + PrefService* local_state = g_browser_process->local_state(); + local_state->SetBoolean(kRemoteDebuggingEnabled, enabled); +} + +void BravePrivacyHandler::GetRemoteDebuggingEnabled( + const base::ListValue* args) { + CHECK_EQ(args->GetSize(), 1U); + + PrefService* local_state = g_browser_process->local_state(); + bool enabled = local_state->GetBoolean(kRemoteDebuggingEnabled); + + AllowJavascript(); + ResolveJavascriptCallback(args->GetList()[0].Clone(), base::Value(enabled)); +} diff --git a/browser/ui/webui/settings/brave_privacy_handler.h b/browser/ui/webui/settings/brave_privacy_handler.h index d1501b5bc10b..b97993986ac9 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.h +++ b/browser/ui/webui/settings/brave_privacy_handler.h @@ -33,6 +33,9 @@ class BravePrivacyHandler : public settings::SettingsPageUIHandler { void SetP3AEnabled(const base::ListValue* args); void GetP3AEnabled(const base::ListValue* args); + void SetRemoteDebuggingEnabled(const base::ListValue* args); + void GetRemoteDebuggingEnabled(const base::ListValue* args); + Profile* profile_ = nullptr; DISALLOW_COPY_AND_ASSIGN(BravePrivacyHandler); diff --git a/chromium_src/chrome/browser/devtools/devtools_ui_bindings.cc b/chromium_src/chrome/browser/devtools/devtools_ui_bindings.cc new file mode 100644 index 000000000000..f65fc24e683a --- /dev/null +++ b/chromium_src/chrome/browser/devtools/devtools_ui_bindings.cc @@ -0,0 +1,26 @@ +/* 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/common/pref_names.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/devtools/devtools_ui_bindings.h" + +#define IsValidRemoteFrontendURL IsValidRemoteFrontendURL_ChromiumImpl +#include "../../../../../../chrome/browser/devtools/devtools_ui_bindings.cc" +#undef IsValidRemoteFrontendURL + +bool DevToolsUIBindings::IsValidRemoteFrontendURL(const GURL& url) { + PrefService* local_state = g_browser_process->local_state(); + if (local_state) { + if (!local_state->GetBoolean(kRemoteDebuggingEnabled)) { + LOG(ERROR) + << "Remote debugging is DISABLED. If you want to use it, please " + "enable in brave://settings/privacy"; + return false; + } + } + + return IsValidRemoteFrontendURL_ChromiumImpl(url); +} diff --git a/chromium_src/chrome/browser/devtools/devtools_ui_bindings.h b/chromium_src/chrome/browser/devtools/devtools_ui_bindings.h new file mode 100644 index 000000000000..6e13a2ccebee --- /dev/null +++ b/chromium_src/chrome/browser/devtools/devtools_ui_bindings.h @@ -0,0 +1,15 @@ +// 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/. + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ + +#define IsValidRemoteFrontendURL \ + IsValidRemoteFrontendURL_ChromiumImpl(const GURL& url); \ + static bool IsValidRemoteFrontendURL +#include "../../../../../chrome/browser/devtools/devtools_ui_bindings.h" +#undef IsValidRemoteFrontendURL + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_DEVTOOLS_DEVTOOLS_UI_BINDINGS_H_ 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 7b5c03a02b46..7f004b685326 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 @@ -162,7 +162,9 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source, {"p3aEnableTitle", IDS_BRAVE_P3A_ENABLE_SETTING}, {"p3aEnabledDesc", - IDS_BRAVE_P3A_ENABLE_SETTING_SUBITEM} + IDS_BRAVE_P3A_ENABLE_SETTING_SUBITEM}, + {"remoteDebuggingEnabledTitle", + IDS_SETTINGS_REMOTE_DEBUGGING_TITLE} }; AddLocalizedStringsBulk(html_source, localized_strings, base::size(localized_strings)); diff --git a/common/pref_names.cc b/common/pref_names.cc index cf1173c75ea7..00a4ff3562ec 100644 --- a/common/pref_names.cc +++ b/common/pref_names.cc @@ -72,6 +72,7 @@ const char kBraveWalletEncryptedSeed[] = "brave.wallet.encrypted_seed"; const char kBraveWalletEnabled[] = "brave.wallet.enabled"; const char kAlwaysShowBookmarkBarOnNTP[] = "brave.always_show_bookmark_bar_on_ntp"; +const char kRemoteDebuggingEnabled[] = "brave.remote_debugging_enabled"; #if defined(OS_ANDROID) const char kDesktopModeEnabled[] = "brave.desktop_mode_enabled"; diff --git a/common/pref_names.h b/common/pref_names.h index 8c3006d77977..5aeb168d93f0 100644 --- a/common/pref_names.h +++ b/common/pref_names.h @@ -61,6 +61,7 @@ extern const char kBraveWalletAES256GCMSivNonce[]; extern const char kBraveWalletEncryptedSeed[]; extern const char kBraveWalletEnabled[]; extern const char kAlwaysShowBookmarkBarOnNTP[]; +extern const char kRemoteDebuggingEnabled[]; #if defined(OS_ANDROID) extern const char kDesktopModeEnabled[]; diff --git a/patches/chrome-browser-ui-webui-devtools_ui_data_source.cc.patch b/patches/chrome-browser-ui-webui-devtools_ui_data_source.cc.patch deleted file mode 100644 index d6d407989b1f..000000000000 --- a/patches/chrome-browser-ui-webui-devtools_ui_data_source.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/chrome/browser/ui/webui/devtools_ui_data_source.cc b/chrome/browser/ui/webui/devtools_ui_data_source.cc -index 95e73c57300e7426d70c669439c18efb68be5337..b177eedddda5d5e4b740d6dee2ae870ac188f938 100644 ---- a/chrome/browser/ui/webui/devtools_ui_data_source.cc -+++ b/chrome/browser/ui/webui/devtools_ui_data_source.cc -@@ -191,6 +191,7 @@ void DevToolsDataSource::StartBundledDataRequest( - void DevToolsDataSource::StartRemoteDataRequest( - const GURL& url, - const content::URLDataSource::GotDataCallback& callback) { -+ return; // feature disabled in Brave - CHECK(url.is_valid()); - net::NetworkTrafficAnnotationTag traffic_annotation = - net::DefineNetworkTrafficAnnotation("devtools_hard_coded_data_source", From b42969415291a703a93ed8a72b585c5f8732c454 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Thu, 21 Nov 2019 23:19:49 -0700 Subject: [PATCH 2/3] Added PrefChangeRegistrar to page to ensure remote debugging enabled value is in sync For example, if you had two windows with brave://settings/privacy open --- .../brave_personalization_options.js | 7 +++++++ .../webui/settings/brave_privacy_handler.cc | 21 +++++++++++++++++++ .../ui/webui/settings/brave_privacy_handler.h | 7 +++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/browser/resources/settings/brave_privacy_page/brave_personalization_options.js b/browser/resources/settings/brave_privacy_page/brave_personalization_options.js index 3707ec292388..591799e23aee 100644 --- a/browser/resources/settings/brave_privacy_page/brave_personalization_options.js +++ b/browser/resources/settings/brave_privacy_page/brave_personalization_options.js @@ -8,6 +8,10 @@ Polymer({ is: 'settings-brave-personalization-options', + behaviors: [ + WebUIListenerBehavior, + ], + properties: { webRTCPolicies_: { readOnly: true, @@ -50,6 +54,9 @@ Polymer({ this.browserProxy_.getRemoteDebuggingEnabled().then(enabled => { this.remoteDebuggingEnabled_ = enabled; }); + this.addWebUIListener('remote-debugging-enabled-changed', (enabled) => { + this.remoteDebuggingEnabled_ = enabled + }) }, /** diff --git a/browser/ui/webui/settings/brave_privacy_handler.cc b/browser/ui/webui/settings/brave_privacy_handler.cc index b9bcd49ba746..5a5ff5af320a 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.cc +++ b/browser/ui/webui/settings/brave_privacy_handler.cc @@ -51,6 +51,18 @@ void BravePrivacyHandler::RegisterMessages() { base::Unretained(this))); } +void BravePrivacyHandler::OnJavascriptAllowed() { + local_state_change_registrar_.Init(g_browser_process->local_state()); + local_state_change_registrar_.Add( + kRemoteDebuggingEnabled, + base::Bind(&BravePrivacyHandler::OnRemoteDebuggingEnabledChanged, + base::Unretained(this))); +} + +void BravePrivacyHandler::OnJavascriptDisallowed() { + local_state_change_registrar_.RemoveAll(); +} + // static void BravePrivacyHandler::AddLoadTimeData(content::WebUIDataSource* data_source, Profile* profile) { @@ -128,3 +140,12 @@ void BravePrivacyHandler::GetRemoteDebuggingEnabled( AllowJavascript(); ResolveJavascriptCallback(args->GetList()[0].Clone(), base::Value(enabled)); } + +void BravePrivacyHandler::OnRemoteDebuggingEnabledChanged() { + if (IsJavascriptAllowed()) { + PrefService* local_state = g_browser_process->local_state(); + bool enabled = local_state->GetBoolean(kRemoteDebuggingEnabled); + + FireWebUIListener("remote-debugging-enabled-changed", base::Value(enabled)); + } +} diff --git a/browser/ui/webui/settings/brave_privacy_handler.h b/browser/ui/webui/settings/brave_privacy_handler.h index b97993986ac9..a9e40c394a52 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.h +++ b/browser/ui/webui/settings/brave_privacy_handler.h @@ -7,6 +7,7 @@ #define BRAVE_BROWSER_UI_WEBUI_SETTINGS_BRAVE_PRIVACY_HANDLER_H_ #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" +#include "components/prefs/pref_change_registrar.h" namespace content { class WebUIDataSource; @@ -24,8 +25,8 @@ class BravePrivacyHandler : public settings::SettingsPageUIHandler { private: // SettingsPageUIHandler overrides: void RegisterMessages() override; - void OnJavascriptAllowed() override {} - void OnJavascriptDisallowed() override {} + void OnJavascriptAllowed() override; + void OnJavascriptDisallowed() override; void SetWebRTCPolicy(const base::ListValue* args); void GetWebRTCPolicy(const base::ListValue* args); @@ -35,8 +36,10 @@ class BravePrivacyHandler : public settings::SettingsPageUIHandler { void SetRemoteDebuggingEnabled(const base::ListValue* args); void GetRemoteDebuggingEnabled(const base::ListValue* args); + void OnRemoteDebuggingEnabledChanged(); Profile* profile_ = nullptr; + PrefChangeRegistrar local_state_change_registrar_; DISALLOW_COPY_AND_ASSIGN(BravePrivacyHandler); }; From e7b2d993072c699df17e7ff86f1756a7954c4925 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Fri, 22 Nov 2019 00:23:22 -0700 Subject: [PATCH 3/3] Optimized initialization of PrefChangeRegistrar (avoiding multiple inits) Thanks to @simonhong for going through the docs w/ me to confirm life-cycle: https://chromium.googlesource.com/chromium/src.git/+/master/docs/webui_explainer.md --- .../webui/settings/brave_privacy_handler.cc | 24 +++++++++---------- .../ui/webui/settings/brave_privacy_handler.h | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/browser/ui/webui/settings/brave_privacy_handler.cc b/browser/ui/webui/settings/brave_privacy_handler.cc index 5a5ff5af320a..4bd735c05321 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.cc +++ b/browser/ui/webui/settings/brave_privacy_handler.cc @@ -24,6 +24,18 @@ #include "brave/browser/gcm_driver/brave_gcm_channel_status.h" #endif +BravePrivacyHandler::BravePrivacyHandler() { + local_state_change_registrar_.Init(g_browser_process->local_state()); + local_state_change_registrar_.Add( + kRemoteDebuggingEnabled, + base::Bind(&BravePrivacyHandler::OnRemoteDebuggingEnabledChanged, + base::Unretained(this))); +} + +BravePrivacyHandler::~BravePrivacyHandler() { + local_state_change_registrar_.RemoveAll(); +} + void BravePrivacyHandler::RegisterMessages() { profile_ = Profile::FromWebUI(web_ui()); @@ -51,18 +63,6 @@ void BravePrivacyHandler::RegisterMessages() { base::Unretained(this))); } -void BravePrivacyHandler::OnJavascriptAllowed() { - local_state_change_registrar_.Init(g_browser_process->local_state()); - local_state_change_registrar_.Add( - kRemoteDebuggingEnabled, - base::Bind(&BravePrivacyHandler::OnRemoteDebuggingEnabledChanged, - base::Unretained(this))); -} - -void BravePrivacyHandler::OnJavascriptDisallowed() { - local_state_change_registrar_.RemoveAll(); -} - // static void BravePrivacyHandler::AddLoadTimeData(content::WebUIDataSource* data_source, Profile* profile) { diff --git a/browser/ui/webui/settings/brave_privacy_handler.h b/browser/ui/webui/settings/brave_privacy_handler.h index a9e40c394a52..9376f6ad7934 100644 --- a/browser/ui/webui/settings/brave_privacy_handler.h +++ b/browser/ui/webui/settings/brave_privacy_handler.h @@ -17,16 +17,16 @@ class Profile; class BravePrivacyHandler : public settings::SettingsPageUIHandler { public: - BravePrivacyHandler() = default; - ~BravePrivacyHandler() override = default; + BravePrivacyHandler(); + ~BravePrivacyHandler() override; static void AddLoadTimeData(content::WebUIDataSource* data_source, Profile* profile); private: // SettingsPageUIHandler overrides: void RegisterMessages() override; - void OnJavascriptAllowed() override; - void OnJavascriptDisallowed() override; + void OnJavascriptAllowed() override {} + void OnJavascriptDisallowed() override {} void SetWebRTCPolicy(const base::ListValue* args); void GetWebRTCPolicy(const base::ListValue* args);