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

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc

Issue 9295044: Start moving signin code out of browser/sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up unnecessary inclusions of signin_manager.h Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h" 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 base::Unretained(this))); 120 base::Unretained(this)));
121 web_ui()->RegisterMessageCallback("SyncPromo:UserFlowAction", 121 web_ui()->RegisterMessageCallback("SyncPromo:UserFlowAction",
122 base::Bind(&SyncPromoHandler::HandleUserFlowAction, 122 base::Bind(&SyncPromoHandler::HandleUserFlowAction,
123 base::Unretained(this))); 123 base::Unretained(this)));
124 web_ui()->RegisterMessageCallback("SyncPromo:UserSkipped", 124 web_ui()->RegisterMessageCallback("SyncPromo:UserSkipped",
125 base::Bind(&SyncPromoHandler::HandleUserSkipped, 125 base::Bind(&SyncPromoHandler::HandleUserSkipped,
126 base::Unretained(this))); 126 base::Unretained(this)));
127 SyncSetupHandler::RegisterMessages(); 127 SyncSetupHandler::RegisterMessages();
128 } 128 }
129 129
130 void SyncPromoHandler::ShowGaiaSuccessAndClose() { 130 void SyncPromoHandler::RecordSignin() {
131 sync_promo_trial::RecordUserSignedIn(web_ui()); 131 sync_promo_trial::RecordUserSignedIn(web_ui());
132 SyncSetupHandler::ShowGaiaSuccessAndClose();
133 }
134
135 void SyncPromoHandler::ShowGaiaSuccessAndSettingUp() {
136 sync_promo_trial::RecordUserSignedIn(web_ui());
137 SyncSetupHandler::ShowGaiaSuccessAndSettingUp();
138 } 132 }
139 133
140 void SyncPromoHandler::ShowConfigure(const base::DictionaryValue& args) { 134 void SyncPromoHandler::ShowConfigure(const base::DictionaryValue& args) {
141 bool usePassphrase = false; 135 bool usePassphrase = false;
142 args.GetBoolean("usePassphrase", &usePassphrase); 136 args.GetBoolean("usePassphrase", &usePassphrase);
143 137
144 if (usePassphrase) { 138 if (usePassphrase) {
145 // If a passphrase is required then we must show the configure pane. 139 // If a passphrase is required then we must show the configure pane.
146 SyncSetupHandler::ShowConfigure(args); 140 SyncSetupHandler::ShowConfigure(args);
147 } else { 141 } else {
(...skipping 26 matching lines...) Expand all
174 window_already_closed_ = true; 168 window_already_closed_ = true;
175 } 169 }
176 break; 170 break;
177 } 171 }
178 default: { 172 default: {
179 NOTREACHED(); 173 NOTREACHED();
180 } 174 }
181 } 175 }
182 } 176 }
183 177
184 void SyncPromoHandler::StepWizardForShowSetupUI() {
185 }
186
187 void SyncPromoHandler::ShowSetupUI() { 178 void SyncPromoHandler::ShowSetupUI() {
188 // SyncSetupWizard::Step should be called in StepWizardForShowSetupUI above,
189 // but it causes the sync promo page to not set focus properly to the login
190 // email address. This happens because focus is lost between the call to
191 // StepWizardForShowSetupUI and ShowSetupUI.
192 // TODO(binji): Move this function back and fix the focus the right way.
193 ProfileSyncService* service =
194 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
195 Profile::FromWebUI(web_ui()));
196 service->get_wizard().Step(SyncSetupWizard::GetLoginState());
197 } 179 }
198 180
199 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { 181 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) {
200 CloseSyncSetup(); 182 CloseSyncSetup();
201 183
202 // If the user has signed in then set the pref to show them NTP bubble 184 // If the user has signed in then set the pref to show them NTP bubble
203 // confirming that they're signed in. 185 // confirming that they're signed in.
204 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); 186 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername);
205 if (!username.empty()) 187 if (!username.empty())
206 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); 188 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // The following call does not use the standard UMA macro because the 299 // The following call does not use the standard UMA macro because the
318 // histogram name is only known at runtime. The standard macros declare 300 // histogram name is only known at runtime. The standard macros declare
319 // static variables that won't work if the name changes on differnt calls. 301 // static variables that won't work if the name changes on differnt calls.
320 if (!histogram_name_.empty()) { 302 if (!histogram_name_.empty()) {
321 base::Histogram* histogram = base::LinearHistogram::FactoryGet( 303 base::Histogram* histogram = base::LinearHistogram::FactoryGet(
322 histogram_name_, 1, SYNC_PROMO_BUCKET_BOUNDARY, 304 histogram_name_, 1, SYNC_PROMO_BUCKET_BOUNDARY,
323 SYNC_PROMO_BUCKET_BOUNDARY + 1, base::Histogram::kNoFlags); 305 SYNC_PROMO_BUCKET_BOUNDARY + 1, base::Histogram::kNoFlags);
324 histogram->Add(action); 306 histogram->Add(action);
325 } 307 }
326 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_promo/sync_promo_handler.h ('k') | chrome/browser/ui/webui/sync_promo/sync_promo_handler2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698