| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 ProfileSyncService* service = GetSyncService(); | 140 ProfileSyncService* service = GetSyncService(); |
| 141 DCHECK(service); | 141 DCHECK(service); |
| 142 if (service->IsPassphraseRequired()) { | 142 if (service->IsPassphraseRequired()) { |
| 143 // If a passphrase is required then we must show the configure pane. | 143 // If a passphrase is required then we must show the configure pane. |
| 144 SyncSetupHandler::DisplayConfigureSync(true, passphrase_failed); | 144 SyncSetupHandler::DisplayConfigureSync(true, passphrase_failed); |
| 145 } else { | 145 } else { |
| 146 // If no passphrase is required then skip the configure pane and sync | 146 // If no passphrase is required then skip the configure pane and sync |
| 147 // everything by default. This makes the first run experience simpler. Note, | 147 // everything by default. This makes the first run experience simpler. Note, |
| 148 // there's an advanced link in the sync promo that takes users to Settings | 148 // there's an advanced link in the sync promo that takes users to Settings |
| 149 // where the configure pane is not skipped. | 149 // where the configure pane is not skipped. |
| 150 service->OnUserChoseDatatypes(true, syncable::ModelTypeSet()); | 150 service->OnUserChoseDatatypes(true, syncer::ModelTypeSet()); |
| 151 ConfigureSyncDone(); | 151 ConfigureSyncDone(); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 void SyncPromoHandler::Observe(int type, | 155 void SyncPromoHandler::Observe(int type, |
| 156 const content::NotificationSource& source, | 156 const content::NotificationSource& source, |
| 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_) |
| (...skipping 113 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 |