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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_page_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/new_tab_page_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
index 759ae8208c2fe56b4b9727549d07589f3c32a643..8085e884f7e51cc97eb1365c261d44add1cccd73 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
+#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
void NewTabPageHandler::RegisterMessages() {
@@ -20,7 +21,9 @@ void NewTabPageHandler::RegisterMessages() {
}
void NewTabPageHandler::HandleClosePromo(const ListValue* args) {
- web_ui_->GetProfile()->GetPrefs()->SetBoolean(prefs::kNTPPromoClosed, true);
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ profile->GetPrefs()->SetBoolean(prefs::kNTPPromoClosed, true);
NotificationService* service = NotificationService::current();
service->Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED,
Source<NewTabPageHandler>(this),
@@ -36,7 +39,9 @@ void NewTabPageHandler::HandlePageSelected(const ListValue* args) {
CHECK(args->GetDouble(1, &index_double));
int index = static_cast<int>(index_double);
- PrefService* prefs = web_ui_->GetProfile()->GetPrefs();
+ Profile* profile =
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
+ PrefService* prefs = profile->GetPrefs();
prefs->SetInteger(prefs::kNTPShownPage, page_id | index);
}

Powered by Google App Engine
This is Rietveld 408576698