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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_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/ntp/app_launcher_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index f6c55fb95e4e4c65009306c8d4f0704642c50dd7..fac8e439713181a6a27776f0328923e5ec0eec57 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -370,7 +370,9 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) {
extension_service_->GetAppIds()));
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) {
- PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ PrefService* prefs = profile->GetPrefs();
const ListValue* app_page_names = prefs->GetList(prefs::kNTPAppPageNames);
if (app_page_names && app_page_names->GetSize()) {
dictionary->Set("appPageNames",
@@ -410,7 +412,9 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) {
// b) Conceptually, it doesn't really make sense to count a
// prefchange-triggered refresh as a promo 'view'.
AppsPromo* apps_promo = extension_service_->apps_promo();
- PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ PrefService* prefs = profile->GetPrefs();
bool apps_promo_just_expired = false;
if (apps_promo->ShouldShowPromo(extension_service_->GetAppIds(),
&apps_promo_just_expired)) {
@@ -682,7 +686,9 @@ void AppLauncherHandler::HandleSaveAppPageName(const ListValue* args) {
CHECK(args->GetDouble(1, &page_index));
AutoReset<bool> auto_reset(&ignore_changes_, true);
- PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ PrefService* prefs = profile->GetPrefs();
ListPrefUpdate update(prefs, prefs::kNTPAppPageNames);
ListValue* list = update.Get();
list->Set(static_cast<size_t>(page_index), Value::CreateStringValue(name));
@@ -706,7 +712,8 @@ void AppLauncherHandler::HandleGenerateAppForLink(const ListValue* args) {
icon.width = icon.height = 16;
web_app->icons.push_back(icon);
- Profile* profile = web_ui_->GetProfile();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
FaviconService* favicon_service =
profile->GetFaviconService(Profile::EXPLICIT_ACCESS);
if (!favicon_service) {
@@ -734,7 +741,9 @@ void AppLauncherHandler::HandleRecordAppLaunchByURL(
static_cast<extension_misc::AppLaunchBucket>(static_cast<int>(source));
CHECK(source < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
- RecordAppLaunchByURL(web_ui_->GetProfile(), url, bucket);
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ RecordAppLaunchByURL(profile, url, bucket);
}
void AppLauncherHandler::OnFaviconForApp(FaviconService::Handle handle,
@@ -897,16 +906,18 @@ void AppLauncherHandler::InstallUIAbort(bool user_initiated) {
ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
if (!extension_uninstall_dialog_.get()) {
- extension_uninstall_dialog_.reset(
- new ExtensionUninstallDialog(web_ui_->GetProfile()));
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ extension_uninstall_dialog_.reset(new ExtensionUninstallDialog(profile));
}
return extension_uninstall_dialog_.get();
}
ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() {
if (!extension_install_ui_.get()) {
- extension_install_ui_.reset(
- new ExtensionInstallUI(web_ui_->GetProfile()));
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ extension_install_ui_.reset(new ExtensionInstallUI(profile));
}
return extension_install_ui_.get();
}

Powered by Google App Engine
This is Rietveld 408576698