Index: chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
index c2973fd8bdaa0dca00eb81467fb1b1359877a3ff..194388b41bcc1e4eedc73582460327768e549605 100644 |
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc |
@@ -14,6 +14,7 @@ |
#include "chrome/browser/sync/sync_setup_flow.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/pref_names.h" |
+#include "content/browser/tab_contents/tab_contents.h" |
#include "content/common/notification_details.h" |
NTPLoginHandler::NTPLoginHandler() { |
@@ -23,7 +24,9 @@ NTPLoginHandler::~NTPLoginHandler() { |
} |
WebUIMessageHandler* NTPLoginHandler::Attach(WebUI* web_ui) { |
- PrefService* pref_service = web_ui->GetProfile()->GetPrefs(); |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui->tab_contents()->browser_context()); |
+ PrefService* pref_service = profile->GetPrefs(); |
username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this); |
return WebUIMessageHandler::Attach(web_ui); |
@@ -48,7 +51,9 @@ void NTPLoginHandler::HandleInitializeLogin(const ListValue* args) { |
} |
void NTPLoginHandler::UpdateLogin() { |
- std::string username = web_ui_->GetProfile()->GetPrefs()->GetString( |
+ Profile* profile = |
+ Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
+ std::string username = profile->GetPrefs()->GetString( |
prefs::kGoogleServicesUsername); |
StringValue string_value(username); |
web_ui_->CallJavascriptFunction("updateLogin", string_value); |