| 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 | |
| 216 // Open the sync wizard to the login screen. | 212 // Open the sync wizard to the login screen. |
| 217 OpenSyncSetup(true); | 213 OpenSyncSetup(true); |
| 218 // We don't need to compute anything for this, just do this every time. | 214 // We don't need to compute anything for this, just do this every time. |
| 219 RecordUserFlowAction(SYNC_PROMO_VIEWED); | 215 RecordUserFlowAction(SYNC_PROMO_VIEWED); |
| 220 // Increment view count first and show natural numbers in stats rather than 0 | 216 // Increment view count first and show natural numbers in stats rather than 0 |
| 221 // based starting point (if it happened to be our first time showing this). | 217 // based starting point (if it happened to be our first time showing this). |
| 222 IncrementViewCountBy(1); | 218 IncrementViewCountBy(1); |
| 223 // Record +1 for every view. This is the only thing we record that's not part | 219 // Record +1 for every view. This is the only thing we record that's not part |
| 224 // of the user flow histogram. | 220 // of the user flow histogram. |
| 225 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); | 221 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // Send an enumeration to our single user flow histogram. | 280 // Send an enumeration to our single user flow histogram. |
| 285 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 281 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
| 286 SYNC_PROMO_BUCKET_BOUNDARY); | 282 SYNC_PROMO_BUCKET_BOUNDARY); |
| 287 } | 283 } |
| 288 | 284 |
| 289 void SyncPromoHandler::CloseUI() { | 285 void SyncPromoHandler::CloseUI() { |
| 290 // Callers should not ever try to close the promo UI (should only call | 286 // Callers should not ever try to close the promo UI (should only call |
| 291 // CloseUI() if the user is already logged in). | 287 // CloseUI() if the user is already logged in). |
| 292 NOTREACHED() << "Cannot close the promo UI"; | 288 NOTREACHED() << "Cannot close the promo UI"; |
| 293 } | 289 } |
| OLD | NEW |