Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Unified Diff: chrome/browser/ui/webui/options/core_options_handler.cc

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698