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 | 212 if (IsActiveLogin()) { |
213 // the old UI closed. If this is an initial load, this call will do nothing. | 213 // Page has been reloaded. We don't need to do initialization of the setup |
214 GetLoginUIService()->LoginUIClosed(this); | 214 // handler but we do have to refresh the page. |
Evan Stade
2012/08/11 00:36:12
the code was calling ShowSetupUI (which called Ope
| |
215 DisplayGaiaLogin(false); | |
Andrew T Wilson (Slow)
2012/08/11 01:10:33
Hmmm. Is this the correct thing to do here? I'm co
Evan Stade
2012/08/11 01:28:55
that code always displays the gaia login when forc
| |
216 } else { | |
217 // Do setup and show the login page. | |
218 OpenSyncSetup(true); | |
219 } | |
215 | 220 |
216 // Open the sync wizard to the login screen. | |
217 OpenSyncSetup(true); | |
218 // We don't need to compute anything for this, just do this every time. | 221 // We don't need to compute anything for this, just do this every time. |
219 RecordUserFlowAction(SYNC_PROMO_VIEWED); | 222 RecordUserFlowAction(SYNC_PROMO_VIEWED); |
220 // Increment view count first and show natural numbers in stats rather than 0 | 223 // 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). | 224 // based starting point (if it happened to be our first time showing this). |
222 IncrementViewCountBy(1); | 225 IncrementViewCountBy(1); |
223 // Record +1 for every view. This is the only thing we record that's not part | 226 // Record +1 for every view. This is the only thing we record that's not part |
224 // of the user flow histogram. | 227 // of the user flow histogram. |
225 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); | 228 UMA_HISTOGRAM_COUNTS("SyncPromo.NumTimesViewed", GetViewCount()); |
226 } | 229 } |
227 | 230 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 // Send an enumeration to our single user flow histogram. | 287 // Send an enumeration to our single user flow histogram. |
285 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 288 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
286 SYNC_PROMO_BUCKET_BOUNDARY); | 289 SYNC_PROMO_BUCKET_BOUNDARY); |
287 } | 290 } |
288 | 291 |
289 void SyncPromoHandler::CloseUI() { | 292 void SyncPromoHandler::CloseUI() { |
290 // Callers should not ever try to close the promo UI (should only call | 293 // Callers should not ever try to close the promo UI (should only call |
291 // CloseUI() if the user is already logged in). | 294 // CloseUI() if the user is already logged in). |
292 NOTREACHED() << "Cannot close the promo UI"; | 295 NOTREACHED() << "Cannot close the promo UI"; |
293 } | 296 } |
OLD | NEW |