| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/task.h" | 20 #include "base/task.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "chrome/browser/browser_thread.h" | |
| 23 #include "chrome/browser/history/history_types.h" | 22 #include "chrome/browser/history/history_types.h" |
| 24 #include "chrome/browser/platform_util.h" | 23 #include "chrome/browser/platform_util.h" |
| 25 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/net/gaia/token_service.h" | 26 #include "chrome/browser/net/gaia/token_service.h" |
| 28 #include "chrome/browser/sync/glue/change_processor.h" | 27 #include "chrome/browser/sync/glue/change_processor.h" |
| 29 #include "chrome/browser/sync/glue/data_type_controller.h" | 28 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 30 #include "chrome/browser/sync/glue/data_type_manager.h" | 29 #include "chrome/browser/sync/glue/data_type_manager.h" |
| 31 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 32 #include "chrome/browser/sync/profile_sync_factory.h" | 31 #include "chrome/browser/sync/profile_sync_factory.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // credentials from the login manager on startup. | 191 // credentials from the login manager on startup. |
| 193 return; | 192 return; |
| 194 } | 193 } |
| 195 | 194 |
| 196 // Try to migrate the tokens (if that hasn't already succeeded). | 195 // Try to migrate the tokens (if that hasn't already succeeded). |
| 197 if (!profile()->GetPrefs()->GetBoolean(prefs::kSyncCredentialsMigrated)) { | 196 if (!profile()->GetPrefs()->GetBoolean(prefs::kSyncCredentialsMigrated)) { |
| 198 token_migrator_.reset(new TokenMigrator(this, profile_->GetPath())); | 197 token_migrator_.reset(new TokenMigrator(this, profile_->GetPath())); |
| 199 token_migrator_->TryMigration(); | 198 token_migrator_->TryMigration(); |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 | |
| 203 } | 201 } |
| 204 | 202 |
| 205 void ProfileSyncService::RegisterAuthNotifications() { | 203 void ProfileSyncService::RegisterAuthNotifications() { |
| 206 registrar_.Add(this, | 204 registrar_.Add(this, |
| 207 NotificationType::TOKEN_AVAILABLE, | 205 NotificationType::TOKEN_AVAILABLE, |
| 208 Source<TokenService>(profile_->GetTokenService())); | 206 Source<TokenService>(profile_->GetTokenService())); |
| 209 registrar_.Add(this, | 207 registrar_.Add(this, |
| 210 NotificationType::TOKEN_LOADING_FINISHED, | 208 NotificationType::TOKEN_LOADING_FINISHED, |
| 211 Source<TokenService>(profile_->GetTokenService())); | 209 Source<TokenService>(profile_->GetTokenService())); |
| 212 registrar_.Add(this, | 210 registrar_.Add(this, |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 // is initialized, all enabled data types are consistent with one | 1147 // is initialized, all enabled data types are consistent with one |
| 1150 // another, and no unrecoverable error has transpired. | 1148 // another, and no unrecoverable error has transpired. |
| 1151 if (unrecoverable_error_detected_) | 1149 if (unrecoverable_error_detected_) |
| 1152 return false; | 1150 return false; |
| 1153 | 1151 |
| 1154 if (!data_type_manager_.get()) | 1152 if (!data_type_manager_.get()) |
| 1155 return false; | 1153 return false; |
| 1156 | 1154 |
| 1157 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1155 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
| 1158 } | 1156 } |
| OLD | NEW |