| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 if (!browser || !browser->IsAttemptingToCloseBrowser()) { | 195 if (!browser || !browser->IsAttemptingToCloseBrowser()) { |
| 196 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( | 196 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( |
| 197 web_ui()->GetWebContents()->GetURL()); | 197 web_ui()->GetWebContents()->GetURL()); |
| 198 OpenURLParams params( | 198 OpenURLParams params( |
| 199 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); | 199 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); |
| 200 web_ui()->GetWebContents()->OpenURL(params); | 200 web_ui()->GetWebContents()->OpenURL(params); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { | 204 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { |
| 205 // TODO(sail): The version argument is going away, remove this. | |
| 206 base::FundamentalValue version(3); | |
| 207 web_ui()->CallJavascriptFunction("SyncSetupOverlay.showPromoVersion", | |
| 208 version); | |
| 209 | |
| 210 // Open the sync wizard to the login screen. | 205 // Open the sync wizard to the login screen. |
| 211 OpenSyncSetup(true); | 206 OpenSyncSetup(true); |
| 212 // We don't need to compute anything for this, just do this every time. | 207 // We don't need to compute anything for this, just do this every time. |
| 213 RecordUserFlowAction(SYNC_PROMO_VIEWED); | 208 RecordUserFlowAction(SYNC_PROMO_VIEWED); |
| 214 // Increment view count first and show natural numbers in stats rather than 0 | 209 // Increment view count first and show natural numbers in stats rather than 0 |
| 215 // based starting point (if it happened to be our first time showing this). | 210 // based starting point (if it happened to be our first time showing this). |
| 216 IncrementViewCountBy(1); | 211 IncrementViewCountBy(1); |
| 217 // Record +1 for every view. This is the only thing we record that's not part | 212 // Record +1 for every view. This is the only thing we record that's not part |
| 218 // of the user flow histogram. | 213 // of the user flow histogram. |
| 219 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); | 214 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // The following call does not use the standard UMA macro because the | 277 // The following call does not use the standard UMA macro because the |
| 283 // histogram name is only known at runtime. The standard macros declare | 278 // histogram name is only known at runtime. The standard macros declare |
| 284 // static variables that won't work if the name changes on differnt calls. | 279 // static variables that won't work if the name changes on differnt calls. |
| 285 if (!histogram_name_.empty()) { | 280 if (!histogram_name_.empty()) { |
| 286 base::Histogram* histogram = base::LinearHistogram::FactoryGet( | 281 base::Histogram* histogram = base::LinearHistogram::FactoryGet( |
| 287 histogram_name_, 1, SYNC_PROMO_BUCKET_BOUNDARY, | 282 histogram_name_, 1, SYNC_PROMO_BUCKET_BOUNDARY, |
| 288 SYNC_PROMO_BUCKET_BOUNDARY + 1, base::Histogram::kNoFlags); | 283 SYNC_PROMO_BUCKET_BOUNDARY + 1, base::Histogram::kNoFlags); |
| 289 histogram->Add(action); | 284 histogram->Add(action); |
| 290 } | 285 } |
| 291 } | 286 } |
| OLD | NEW |