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

Unified Diff: chrome/browser/extensions/extensions_ui.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_context Created 9 years, 5 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/extensions/extensions_ui.cc
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 8eb68c83407ca062febc878a8f377ad46de023b8..4d42120a444e3a267bf6abe475e074a7938d9aef 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -242,7 +242,9 @@ void ExtensionsDOMHandler::HandleRequestExtensionsData(const ListValue* args) {
}
results.Set("extensions", extensions_list);
- bool developer_mode = web_ui_->GetProfile()->GetPrefs()
+ Profile* profile =
+ static_cast<Profile*>(web_ui_->tab_contents()->browser_context());
+ bool developer_mode = profile->GetPrefs()
->GetBoolean(prefs::kExtensionsUIDeveloperMode);
results.SetBoolean("developerMode", developer_mode);
@@ -281,16 +283,20 @@ void ExtensionsDOMHandler::RegisterForNotifications() {
ExtensionUninstallDialog* ExtensionsDOMHandler::GetExtensionUninstallDialog() {
if (!extension_uninstall_dialog_.get()) {
+ Profile* profile =
+ static_cast<Profile*>(web_ui_->tab_contents()->browser_context());
extension_uninstall_dialog_.reset(
- new ExtensionUninstallDialog(web_ui_->GetProfile()));
+ new ExtensionUninstallDialog(profile));
}
return extension_uninstall_dialog_.get();
}
void ExtensionsDOMHandler::HandleToggleDeveloperMode(const ListValue* args) {
- bool developer_mode = web_ui_->GetProfile()->GetPrefs()
+ Profile* profile =
+ static_cast<Profile*>(web_ui_->tab_contents()->browser_context());
+ bool developer_mode = profile->GetPrefs()
->GetBoolean(prefs::kExtensionsUIDeveloperMode);
- web_ui_->GetProfile()->GetPrefs()->SetBoolean(
+ profile->GetPrefs()->SetBoolean(
prefs::kExtensionsUIDeveloperMode, !developer_mode);
}
@@ -337,8 +343,10 @@ void ExtensionsDOMHandler::HandleEnableMessage(const ListValue* args) {
if (enable_str == "true") {
ExtensionPrefs* prefs = extension_service_->extension_prefs();
if (prefs->DidExtensionEscalatePermissions(extension_id)) {
+ Profile* profile =
+ static_cast<Profile*>(web_ui_->tab_contents()->browser_context());
ShowExtensionDisabledDialog(extension_service_,
- web_ui_->GetProfile(), extension);
+ profile, extension);
} else {
extension_service_->EnableExtension(extension_id);
}
@@ -450,8 +458,9 @@ void ExtensionsDOMHandler::HandleOptionsMessage(const ListValue* args) {
const Extension* extension = GetExtension(args);
if (!extension || extension->options_url().is_empty())
return;
- web_ui_->GetProfile()->GetExtensionProcessManager()->OpenOptionsPage(
- extension, NULL);
+ Profile* profile =
+ static_cast<Profile*>(web_ui_->tab_contents()->browser_context());
+ profile->GetExtensionProcessManager()->OpenOptionsPage(extension, NULL);
}
void ExtensionsDOMHandler::HandleShowButtonMessage(const ListValue* args) {
@@ -758,7 +767,7 @@ void ExtensionsDOMHandler::GetActivePagesForExtensionProcess(
}
result->push_back(ExtensionPage(url, process->id(), host->routing_id(),
- process->profile()->IsOffTheRecord()));
+ process->context()->IsOffTheRecord()));
}
}
@@ -777,15 +786,16 @@ ExtensionsDOMHandler::~ExtensionsDOMHandler() {
// ExtensionsDOMHandler, public: -----------------------------------------------
ExtensionsUI::ExtensionsUI(TabContents* contents) : ChromeWebUI(contents) {
- ExtensionService *exstension_service =
- GetProfile()->GetOriginalProfile()->GetExtensionService();
+ Profile* profile = static_cast<Profile*>(contents->browser_context());
+ ExtensionService *extension_service =
+ profile->GetOriginalProfile()->GetExtensionService();
- ExtensionsDOMHandler* handler = new ExtensionsDOMHandler(exstension_service);
+ ExtensionsDOMHandler* handler = new ExtensionsDOMHandler(extension_service);
AddMessageHandler(handler);
handler->Attach(this);
// Set up the chrome://extensions/ source.
- contents->profile()->GetChromeURLDataManager()->AddDataSource(
+ profile->GetChromeURLDataManager()->AddDataSource(
CreateExtensionsUIHTMLSource());
}

Powered by Google App Engine
This is Rietveld 408576698