OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_handler.h" | 5 #include "chrome/browser/ui/webui/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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 window_already_closed_ = true; | 172 window_already_closed_ = true; |
173 } | 173 } |
174 break; | 174 break; |
175 } | 175 } |
176 default: { | 176 default: { |
177 NOTREACHED(); | 177 NOTREACHED(); |
178 } | 178 } |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 void SyncPromoHandler::ShowSetupUI() { | 182 void SyncPromoHandler::StepWizardForShowSetupUI() { |
183 ProfileSyncService* service = | 183 ProfileSyncService* service = |
184 Profile::FromWebUI(web_ui_)->GetProfileSyncService(); | 184 Profile::FromWebUI(web_ui_)->GetProfileSyncService(); |
185 service->get_wizard().Step(SyncSetupWizard::GetLoginState()); | 185 service->get_wizard().Step(SyncSetupWizard::GetLoginState()); |
186 } | 186 } |
187 | 187 |
| 188 void SyncPromoHandler::ShowSetupUI() { |
| 189 // We don't need to do anything here; The UI for the sync promo is already |
| 190 // displayed. |
| 191 } |
| 192 |
188 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { | 193 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { |
189 CloseSyncSetup(); | 194 CloseSyncSetup(); |
190 | 195 |
191 // If the user has signed in then set the pref to show them NTP bubble | 196 // If the user has signed in then set the pref to show them NTP bubble |
192 // confirming that they're signed in. | 197 // confirming that they're signed in. |
193 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); | 198 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); |
194 if (!username.empty()) | 199 if (!username.empty()) |
195 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); | 200 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); |
196 | 201 |
197 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( | 202 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 int adjusted = GetViewCount() + amount; | 279 int adjusted = GetViewCount() + amount; |
275 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted); | 280 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted); |
276 return adjusted; | 281 return adjusted; |
277 } | 282 } |
278 | 283 |
279 void SyncPromoHandler::RecordUserFlowAction(int action) { | 284 void SyncPromoHandler::RecordUserFlowAction(int action) { |
280 // Send an enumeration to our single user flow histogram. | 285 // Send an enumeration to our single user flow histogram. |
281 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 286 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
282 SYNC_PROMO_BUCKET_BOUNDARY); | 287 SYNC_PROMO_BUCKET_BOUNDARY); |
283 } | 288 } |
OLD | NEW |