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); |
} |