| Index: chrome/browser/ui/webui/options/browser_options_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| index e1e0e6c38a6a6e5cd4b840db19d7ae6a9e5b423f..30d909ebde583d65e2d1bfee24c0f14037374214 100644
|
| --- a/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| @@ -599,8 +599,9 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
|
| IDS_PROFILES_LEGACY_SUPERVISED_USER_DASHBOARD_TIP,
|
| supervised_user_dashboard));
|
|
|
| -#if defined(OS_CHROMEOS)
|
| Profile* profile = Profile::FromWebUI(web_ui());
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| std::string username = profile->GetProfileUserName();
|
| if (username.empty()) {
|
| const user_manager::User* user =
|
| @@ -676,12 +677,8 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
|
| allow_deletion = allow_deletion && !ash::WmShell::HasInstance();
|
| #endif
|
| values->SetBoolean("allowProfileDeletion", allow_deletion);
|
| -
|
| - values->SetBoolean("profileIsGuest",
|
| - Profile::FromWebUI(web_ui())->IsOffTheRecord());
|
| -
|
| - values->SetBoolean("profileIsSupervised",
|
| - Profile::FromWebUI(web_ui())->IsSupervised());
|
| + values->SetBoolean("profileIsGuest", profile->IsOffTheRecord());
|
| + values->SetBoolean("profileIsSupervised", profile->IsSupervised());
|
|
|
| #if !defined(OS_CHROMEOS)
|
| values->SetBoolean(
|
| @@ -711,8 +708,7 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
|
| chrome::kLanguageSettingsLearnMoreUrl);
|
|
|
| values->SetBoolean(
|
| - "easyUnlockAllowed",
|
| - EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed());
|
| + "easyUnlockAllowed", EasyUnlockService::Get(profile)->IsAllowed());
|
| values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl);
|
| values->SetBoolean("easyUnlockProximityDetectionAllowed",
|
| base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| @@ -738,8 +734,7 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) {
|
| values->SetBoolean("enableTimeZoneTrackingOption",
|
| !chromeos::system::HasSystemTimezonePolicy());
|
| values->SetBoolean("resolveTimezoneByGeolocationInitialValue",
|
| - Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean(
|
| - prefs::kResolveTimezoneByGeolocation));
|
| + profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation));
|
| values->SetBoolean("enableLanguageOptionsImeMenu",
|
| base::FeatureList::IsEnabled(features::kOptInImeMenu));
|
| values->SetBoolean(
|
| @@ -1003,11 +998,11 @@ void BrowserOptionsHandler::InitializeHandler() {
|
| AddTemplateUrlServiceObserver();
|
|
|
| #if defined(OS_WIN)
|
| - ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->AddObserver(this);
|
| + ExtensionRegistry::Get(profile)->AddObserver(this);
|
| #endif
|
|
|
| // No preferences below this point may be modified by guest profiles.
|
| - if (Profile::FromWebUI(web_ui())->IsGuestSession())
|
| + if (profile->IsGuestSession())
|
| return;
|
|
|
| auto_open_files_.Init(
|
| @@ -1159,8 +1154,7 @@ bool BrowserOptionsHandler::ShouldShowSetDefaultBrowser() {
|
| // We're always the default browser on ChromeOS.
|
| return false;
|
| #else
|
| - Profile* profile = Profile::FromWebUI(web_ui());
|
| - return !profile->IsGuestSession();
|
| + return !Profile::FromWebUI(web_ui())->IsGuestSession();
|
| #endif
|
| }
|
|
|
| @@ -1169,8 +1163,7 @@ bool BrowserOptionsHandler::ShouldShowMultiProfilesUserList() {
|
| // On Chrome OS we use different UI for multi-profiles.
|
| return false;
|
| #else
|
| - Profile* profile = Profile::FromWebUI(web_ui());
|
| - if (profile->IsGuestSession())
|
| + if (Profile::FromWebUI(web_ui())->IsGuestSession())
|
| return false;
|
| return profiles::IsMultipleProfilesEnabled();
|
| #endif
|
| @@ -2152,42 +2145,27 @@ void BrowserOptionsHandler::SetupEasyUnlock() {
|
| void BrowserOptionsHandler::SetupExtensionControlledIndicators() {
|
| base::DictionaryValue extension_controlled;
|
|
|
| + Profile* profile = Profile::FromWebUI(web_ui());
|
| +
|
| // Check if an extension is overriding the Search Engine.
|
| const extensions::Extension* extension =
|
| - extensions::GetExtensionOverridingSearchEngine(
|
| - Profile::FromWebUI(web_ui()));
|
| + extensions::GetExtensionOverridingSearchEngine(profile);
|
| AppendExtensionData("searchEngine", extension, &extension_controlled);
|
|
|
| // Check if an extension is overriding the Home page.
|
| - extension = extensions::GetExtensionOverridingHomepage(
|
| - Profile::FromWebUI(web_ui()));
|
| + extension = extensions::GetExtensionOverridingHomepage(profile);
|
| AppendExtensionData("homePage", extension, &extension_controlled);
|
|
|
| // Check if an extension is overriding the Startup pages.
|
| - extension = extensions::GetExtensionOverridingStartupPages(
|
| - Profile::FromWebUI(web_ui()));
|
| + extension = extensions::GetExtensionOverridingStartupPages(profile);
|
| AppendExtensionData("startUpPage", extension, &extension_controlled);
|
|
|
| // Check if an extension is overriding the NTP page.
|
| - GURL ntp_url(chrome::kChromeUINewTabURL);
|
| - bool ignored_param;
|
| - extension = NULL;
|
| - content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
|
| - &ntp_url,
|
| - web_ui()->GetWebContents()->GetBrowserContext(),
|
| - &ignored_param);
|
| - if (ntp_url.SchemeIs("chrome-extension")) {
|
| - using extensions::ExtensionRegistry;
|
| - ExtensionRegistry* registry = ExtensionRegistry::Get(
|
| - Profile::FromWebUI(web_ui()));
|
| - extension = registry->GetExtensionById(ntp_url.host(),
|
| - ExtensionRegistry::ENABLED);
|
| - }
|
| + extension = extensions::GetExtensionOverridingNewTabPage(profile);
|
| AppendExtensionData("newTabPage", extension, &extension_controlled);
|
|
|
| // Check if an extension is overwriting the proxy setting.
|
| - extension = extensions::GetExtensionOverridingProxy(
|
| - Profile::FromWebUI(web_ui()));
|
| + extension = extensions::GetExtensionOverridingProxy(profile);
|
| AppendExtensionData("proxy", extension, &extension_controlled);
|
|
|
| web_ui()->CallJavascriptFunctionUnsafe(
|
|
|