| 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 c8e823d883268a7557103d8667a8880a3d102f2a..67a41ce88f83521fdb597016bc00c8af5c9a20b7 100644
|
| --- a/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
|
| @@ -29,6 +29,7 @@
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "content/browser/browser_thread.h"
|
| +#include "content/browser/tab_contents/tab_contents.h"
|
| #include "content/browser/user_metrics.h"
|
| #include "content/common/notification_details.h"
|
| #include "content/common/notification_service.h"
|
| @@ -139,7 +140,8 @@ void BrowserOptionsHandler::RegisterMessages() {
|
| }
|
|
|
| void BrowserOptionsHandler::Initialize() {
|
| - Profile* profile = web_ui_->GetProfile();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
|
|
| // Create our favicon data source.
|
| profile->GetChromeURLDataManager()->AddDataSource(
|
| @@ -222,7 +224,9 @@ void BrowserOptionsHandler::BecomeDefaultBrowser(const ListValue* args) {
|
|
|
| // If the user attempted to make Chrome the default browser, then he/she
|
| // arguably wants to be notified when that changes.
|
| - PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + PrefService* prefs = profile->GetPrefs();
|
| prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
|
| }
|
|
|
| @@ -316,8 +320,9 @@ void BrowserOptionsHandler::SetDefaultSearchEngine(const ListValue* args) {
|
| }
|
|
|
| void BrowserOptionsHandler::UpdateSearchEngines() {
|
| - template_url_service_ = TemplateURLServiceFactory::GetForProfile(
|
| - web_ui_->GetProfile());
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile);
|
| if (template_url_service_) {
|
| template_url_service_->Load();
|
| template_url_service_->AddObserver(this);
|
| @@ -326,7 +331,8 @@ void BrowserOptionsHandler::UpdateSearchEngines() {
|
| }
|
|
|
| void BrowserOptionsHandler::UpdateRestoreOnStartup() {
|
| - Profile* profile = web_ui_->GetProfile();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| const SessionStartupPref startup_pref =
|
| SessionStartupPref::GetStartupPref(profile->GetPrefs());
|
| FundamentalValue restore_on_startup(startup_pref.type);
|
| @@ -335,7 +341,8 @@ void BrowserOptionsHandler::UpdateRestoreOnStartup() {
|
| }
|
|
|
| void BrowserOptionsHandler::UpdateStartupPages() {
|
| - Profile* profile = web_ui_->GetProfile();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| const SessionStartupPref startup_pref =
|
| SessionStartupPref::GetStartupPref(profile->GetPrefs());
|
| startup_custom_pages_table_model_->SetURLs(startup_pref.urls);
|
| @@ -401,7 +408,9 @@ void BrowserOptionsHandler::SetRestoreOnStartup(const ListValue* args) {
|
| CHECK_EQ(args->GetSize(), 1UL);
|
| CHECK(args->GetString(0, &pref_string));
|
|
|
| - PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + PrefService* prefs = profile->GetPrefs();
|
|
|
| SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
|
| if (pref_string == "0") {
|
| @@ -491,7 +500,9 @@ void BrowserOptionsHandler::DragDropStartupPage(const ListValue* args) {
|
| }
|
|
|
| void BrowserOptionsHandler::SaveStartupPagesPref() {
|
| - PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + PrefService* prefs = profile->GetPrefs();
|
|
|
| SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
|
| pref.urls = startup_custom_pages_table_model_->GetURLs();
|
| @@ -510,7 +521,9 @@ void BrowserOptionsHandler::RequestAutocompleteSuggestions(
|
| }
|
|
|
| void BrowserOptionsHandler::ToggleShowBookmarksBar(const ListValue* args) {
|
| - Source<Profile> source(web_ui_->GetProfile());
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + Source<Profile> source(profile);
|
| NotificationService::current()->Notify(
|
| chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
|
| source,
|
| @@ -518,16 +531,22 @@ void BrowserOptionsHandler::ToggleShowBookmarksBar(const ListValue* args) {
|
| }
|
|
|
| void BrowserOptionsHandler::EnableInstant(const ListValue* args) {
|
| - InstantController::Enable(web_ui_->GetProfile());
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + InstantController::Enable(profile);
|
| }
|
|
|
| void BrowserOptionsHandler::DisableInstant(const ListValue* args) {
|
| - InstantController::Disable(web_ui_->GetProfile());
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + InstantController::Disable(profile);
|
| }
|
|
|
| void BrowserOptionsHandler::GetInstantFieldTrialStatus(const ListValue* args) {
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| FundamentalValue enabled(
|
| - InstantFieldTrial::IsExperimentGroup(web_ui_->GetProfile()));
|
| + InstantFieldTrial::IsExperimentGroup(profile));
|
| web_ui_->CallJavascriptFunction("BrowserOptions.setInstantFieldTrialStatus",
|
| enabled);
|
| }
|
|
|