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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_login_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/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);

Powered by Google App Engine
This is Rietveld 408576698