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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_sync_setup_handler.cc

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Profile helper function, 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_sync_setup_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_sync_setup_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_sync_setup_handler.cc
index ba21e557757e60b5547e49234f4a00e720d334c9..954f3f2dac809fc567d1ea95a546c7dd01561a84 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_sync_setup_handler.cc
@@ -33,7 +33,7 @@ bool NewTabSyncSetupHandler::ShouldShowSyncPromo() {
}
WebUIMessageHandler* NewTabSyncSetupHandler::Attach(WebUI* web_ui) {
- PrefService* pref_service = web_ui->GetProfile()->GetPrefs();
+ PrefService* pref_service = Profile::FromWebUI(web_ui)->GetPrefs();
username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this);
return SyncSetupHandler::Attach(web_ui);
@@ -64,7 +64,8 @@ void NewTabSyncSetupHandler::Observe(int type,
}
void NewTabSyncSetupHandler::ShowSetupUI() {
- ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService();
+ ProfileSyncService* service =
+ Profile::FromWebUI(web_ui_)->GetProfileSyncService();
service->get_wizard().Step(SyncSetupWizard::GetLoginState());
}
@@ -77,14 +78,14 @@ void NewTabSyncSetupHandler::HandleInitializeSyncPromo(const ListValue* args) {
UpdateLogin();
- ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService();
+ Profile* profile = Profile::FromWebUI(web_ui_);
+ ProfileSyncService* service = profile->GetProfileSyncService();
DCHECK(service);
// If the user has not signed into sync then expand the sync promo.
// TODO(sail): Need to throttle this behind a server side flag.
if (!service->HasSyncSetupCompleted() &&
- web_ui_->GetProfile()->GetPrefs()->GetBoolean(
- prefs::kSyncPromoExpanded)) {
+ profile->GetPrefs()->GetBoolean(prefs::kSyncPromoExpanded)) {
OpenSyncSetup();
SaveExpandedPreference(true);
}
@@ -102,7 +103,7 @@ void NewTabSyncSetupHandler::HandleExpandSyncPromo(const ListValue* args) {
}
void NewTabSyncSetupHandler::UpdateLogin() {
- std::string username = web_ui_->GetProfile()->GetPrefs()->GetString(
+ std::string username = Profile::FromWebUI(web_ui_)->GetPrefs()->GetString(
prefs::kGoogleServicesUsername);
StringValue string_value(username);
web_ui_->CallJavascriptFunction("new_tab.NewTabSyncPromo.updateLogin",
@@ -110,7 +111,7 @@ void NewTabSyncSetupHandler::UpdateLogin() {
}
void NewTabSyncSetupHandler::SaveExpandedPreference(bool is_expanded) {
- web_ui_->GetProfile()->GetPrefs()->SetBoolean(prefs::kSyncPromoExpanded,
- is_expanded);
- web_ui_->GetProfile()->GetPrefs()->ScheduleSavePersistentPrefs();
+ Profile* profile = Profile::FromWebUI(web_ui_);
+ profile->GetPrefs()->SetBoolean(prefs::kSyncPromoExpanded, is_expanded);
+ profile->GetPrefs()->ScheduleSavePersistentPrefs();
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc ('k') | chrome/browser/ui/webui/ntp/ntp_login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698