OLD | NEW |
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } else { | 202 } else { |
203 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(sync_url); | 203 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(sync_url); |
204 OpenURLParams params( | 204 OpenURLParams params( |
205 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); | 205 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); |
206 web_ui()->GetWebContents()->OpenURL(params); | 206 web_ui()->GetWebContents()->OpenURL(params); |
207 } | 207 } |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { | 211 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { |
| 212 // If this is a page reload, then we have to inform the login service |
| 213 // the old UI closed. If this is an initial load, this call will do nothing. |
| 214 GetLoginUIService()->LoginUIClosed(this); |
| 215 |
212 // Open the sync wizard to the login screen. | 216 // Open the sync wizard to the login screen. |
213 OpenSyncSetup(true); | 217 OpenSyncSetup(true); |
214 // We don't need to compute anything for this, just do this every time. | 218 // We don't need to compute anything for this, just do this every time. |
215 RecordUserFlowAction(SYNC_PROMO_VIEWED); | 219 RecordUserFlowAction(SYNC_PROMO_VIEWED); |
216 // Increment view count first and show natural numbers in stats rather than 0 | 220 // Increment view count first and show natural numbers in stats rather than 0 |
217 // based starting point (if it happened to be our first time showing this). | 221 // based starting point (if it happened to be our first time showing this). |
218 IncrementViewCountBy(1); | 222 IncrementViewCountBy(1); |
219 // Record +1 for every view. This is the only thing we record that's not part | 223 // Record +1 for every view. This is the only thing we record that's not part |
220 // of the user flow histogram. | 224 // of the user flow histogram. |
221 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); | 225 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // Send an enumeration to our single user flow histogram. | 284 // Send an enumeration to our single user flow histogram. |
281 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 285 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
282 SYNC_PROMO_BUCKET_BOUNDARY); | 286 SYNC_PROMO_BUCKET_BOUNDARY); |
283 } | 287 } |
284 | 288 |
285 void SyncPromoHandler::CloseUI() { | 289 void SyncPromoHandler::CloseUI() { |
286 // Callers should not ever try to close the promo UI (should only call | 290 // Callers should not ever try to close the promo UI (should only call |
287 // CloseUI() if the user is already logged in). | 291 // CloseUI() if the user is already logged in). |
288 NOTREACHED() << "Cannot close the promo UI"; | 292 NOTREACHED() << "Cannot close the promo UI"; |
289 } | 293 } |
OLD | NEW |