Index: chrome/browser/ui/webui/options/core_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc |
index 13fbed9bce1f3936b2873e69e66391776a14d43e..66d28a2c878aec8abb06b8929d0751a89975ba18 100644 |
--- a/chrome/browser/ui/webui/options/core_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/core_options_handler.cc |
@@ -17,6 +17,7 @@ |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/common/url_constants.h" |
+#include "content/browser/tab_contents/tab_contents.h" |
#include "content/browser/user_metrics.h" |
#include "content/common/content_notification_types.h" |
#include "content/common/notification_details.h" |
@@ -112,7 +113,9 @@ void CoreOptionsHandler::Uninitialize() { |
WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) { |
WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui); |
DCHECK(web_ui_); |
- registrar_.Init(web_ui_->GetProfile()->GetPrefs()); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
+ registrar_.Init(profile->GetPrefs()); |
return result; |
} |
@@ -152,7 +155,9 @@ void CoreOptionsHandler::HandleInitialize(const ListValue* args) { |
} |
Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) { |
- PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
+ PrefService* pref_service = profile->GetPrefs(); |
const PrefService::Preference* pref = |
pref_service->FindPreference(pref_name.c_str()); |
@@ -169,7 +174,9 @@ void CoreOptionsHandler::ObservePref(const std::string& pref_name) { |
void CoreOptionsHandler::SetPref(const std::string& pref_name, |
const Value* value, |
const std::string& metric) { |
- PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
+ PrefService* pref_service = profile->GetPrefs(); |
switch (value->GetType()) { |
case Value::TYPE_BOOLEAN: |
@@ -190,7 +197,9 @@ void CoreOptionsHandler::SetPref(const std::string& pref_name, |
void CoreOptionsHandler::ClearPref(const std::string& pref_name, |
const std::string& metric) { |
- PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
+ PrefService* pref_service = profile->GetPrefs(); |
pref_service->ClearPref(pref_name.c_str()); |
pref_service->ScheduleSavePersistentPrefs(); |
@@ -377,7 +386,9 @@ void CoreOptionsHandler::NotifyPrefChanged(const std::string* pref_name) { |
return; |
} |
- PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
+ PrefService* pref_service = profile->GetPrefs(); |
const PrefService::Preference* pref = |
pref_service->FindPreference(pref_name->c_str()); |
if (!pref) |