| 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..9320db385c8e67549a07cd6dd550b16c1fd99b16 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
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/pref_names.h"
|
| +#include "content/browser/tab_contents/tab_contents.h"
|
| #include "content/common/notification_details.h"
|
|
|
| NewTabSyncSetupHandler::NewTabSyncSetupHandler() : SyncSetupHandler() {
|
| @@ -33,7 +34,9 @@ bool NewTabSyncSetupHandler::ShouldShowSyncPromo() {
|
| }
|
|
|
| WebUIMessageHandler* NewTabSyncSetupHandler::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 SyncSetupHandler::Attach(web_ui);
|
| @@ -64,7 +67,9 @@ void NewTabSyncSetupHandler::Observe(int type,
|
| }
|
|
|
| void NewTabSyncSetupHandler::ShowSetupUI() {
|
| - ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + ProfileSyncService* service = profile->GetProfileSyncService();
|
| service->get_wizard().Step(SyncSetupWizard::GetLoginState());
|
| }
|
|
|
| @@ -77,14 +82,15 @@ void NewTabSyncSetupHandler::HandleInitializeSyncPromo(const ListValue* args) {
|
|
|
| UpdateLogin();
|
|
|
| - ProfileSyncService* service = web_ui_->GetProfile()->GetProfileSyncService();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + 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 +108,9 @@ void NewTabSyncSetupHandler::HandleExpandSyncPromo(const ListValue* args) {
|
| }
|
|
|
| void NewTabSyncSetupHandler::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("new_tab.NewTabSyncPromo.updateLogin",
|
| @@ -110,7 +118,8 @@ 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::FromBrowserContext(web_ui_->tab_contents()->browser_context());
|
| + profile->GetPrefs()->SetBoolean(prefs::kSyncPromoExpanded, is_expanded);
|
| + profile->GetPrefs()->ScheduleSavePersistentPrefs();
|
| }
|
|
|