| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 const content::NotificationDetails& details) { | 157 const content::NotificationDetails& details) { |
| 158 switch (type) { | 158 switch (type) { |
| 159 case chrome::NOTIFICATION_TAB_CLOSING: { | 159 case chrome::NOTIFICATION_TAB_CLOSING: { |
| 160 if (!window_already_closed_) | 160 if (!window_already_closed_) |
| 161 RecordUserFlowAction(SYNC_PROMO_CLOSED_TAB); | 161 RecordUserFlowAction(SYNC_PROMO_CLOSED_TAB); |
| 162 break; | 162 break; |
| 163 } | 163 } |
| 164 case chrome::NOTIFICATION_BROWSER_CLOSING: { | 164 case chrome::NOTIFICATION_BROWSER_CLOSING: { |
| 165 // Make sure we're in the tab strip of the closing window. | 165 // Make sure we're in the tab strip of the closing window. |
| 166 Browser* browser = content::Source<Browser>(source).ptr(); | 166 Browser* browser = content::Source<Browser>(source).ptr(); |
| 167 if (browser->tab_strip_model()->GetWrapperIndex( | 167 if (browser->tab_strip_model()->GetIndexOfWebContents( |
| 168 web_ui()->GetWebContents()) != TabStripModel::kNoTab) { | 168 web_ui()->GetWebContents()) != TabStripModel::kNoTab) { |
| 169 RecordUserFlowAction(SYNC_PROMO_CLOSED_WINDOW); | 169 RecordUserFlowAction(SYNC_PROMO_CLOSED_WINDOW); |
| 170 window_already_closed_ = true; | 170 window_already_closed_ = true; |
| 171 } | 171 } |
| 172 break; | 172 break; |
| 173 } | 173 } |
| 174 default: { | 174 default: { |
| 175 NOTREACHED(); | 175 NOTREACHED(); |
| 176 } | 176 } |
| 177 } | 177 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // Send an enumeration to our single user flow histogram. | 274 // Send an enumeration to our single user flow histogram. |
| 275 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 275 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
| 276 SYNC_PROMO_BUCKET_BOUNDARY); | 276 SYNC_PROMO_BUCKET_BOUNDARY); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void SyncPromoHandler::CloseUI() { | 279 void SyncPromoHandler::CloseUI() { |
| 280 // Callers should not ever try to close the promo UI (should only call | 280 // Callers should not ever try to close the promo UI (should only call |
| 281 // CloseUI() if the user is already logged in). | 281 // CloseUI() if the user is already logged in). |
| 282 NOTREACHED() << "Cannot close the promo UI"; | 282 NOTREACHED() << "Cannot close the promo UI"; |
| 283 } | 283 } |
| OLD | NEW |