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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 Profile* profile, | 210 Profile* profile, |
211 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper, | 211 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper, |
212 ProfileOAuth2TokenService* oauth2_token_service, | 212 ProfileOAuth2TokenService* oauth2_token_service, |
213 ProfileSyncServiceStartBehavior start_behavior) | 213 ProfileSyncServiceStartBehavior start_behavior) |
214 : OAuth2TokenService::Consumer("sync"), | 214 : OAuth2TokenService::Consumer("sync"), |
215 last_auth_error_(AuthError::AuthErrorNone()), | 215 last_auth_error_(AuthError::AuthErrorNone()), |
216 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), | 216 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), |
217 factory_(factory.Pass()), | 217 factory_(factory.Pass()), |
218 profile_(profile), | 218 profile_(profile), |
219 sync_prefs_(profile_->GetPrefs()), | 219 sync_prefs_(profile_->GetPrefs()), |
220 sync_service_url_(GetSyncServiceURL(*CommandLine::ForCurrentProcess())), | 220 sync_service_url_( |
| 221 GetSyncServiceURL(*base::CommandLine::ForCurrentProcess())), |
221 is_first_time_sync_configure_(false), | 222 is_first_time_sync_configure_(false), |
222 backend_initialized_(false), | 223 backend_initialized_(false), |
223 sync_disabled_by_admin_(false), | 224 sync_disabled_by_admin_(false), |
224 is_auth_in_progress_(false), | 225 is_auth_in_progress_(false), |
225 signin_(signin_wrapper.Pass()), | 226 signin_(signin_wrapper.Pass()), |
226 unrecoverable_error_reason_(ERROR_REASON_UNSET), | 227 unrecoverable_error_reason_(ERROR_REASON_UNSET), |
227 expect_sync_configuration_aborted_(false), | 228 expect_sync_configuration_aborted_(false), |
228 encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()), | 229 encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()), |
229 encrypt_everything_allowed_(true), | 230 encrypt_everything_allowed_(true), |
230 encrypt_everything_(false), | 231 encrypt_everything_(false), |
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 } | 2461 } |
2461 | 2462 |
2462 void ProfileSyncService::SyncEvent(SyncEventCodes code) { | 2463 void ProfileSyncService::SyncEvent(SyncEventCodes code) { |
2463 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); | 2464 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); |
2464 } | 2465 } |
2465 | 2466 |
2466 // static | 2467 // static |
2467 bool ProfileSyncService::IsSyncEnabled() { | 2468 bool ProfileSyncService::IsSyncEnabled() { |
2468 // We have switches::kEnableSync just in case we need to change back to | 2469 // We have switches::kEnableSync just in case we need to change back to |
2469 // sync-disabled-by-default on a platform. | 2470 // sync-disabled-by-default on a platform. |
2470 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSync); | 2471 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2472 switches::kDisableSync); |
2471 } | 2473 } |
2472 | 2474 |
2473 bool ProfileSyncService::IsManaged() const { | 2475 bool ProfileSyncService::IsManaged() const { |
2474 return sync_prefs_.IsManaged() || sync_disabled_by_admin_; | 2476 return sync_prefs_.IsManaged() || sync_disabled_by_admin_; |
2475 } | 2477 } |
2476 | 2478 |
2477 void ProfileSyncService::StopAndSuppress() { | 2479 void ProfileSyncService::StopAndSuppress() { |
2478 sync_prefs_.SetStartSuppressed(true); | 2480 sync_prefs_.SetStartSuppressed(true); |
2479 if (HasSyncingBackend()) { | 2481 if (HasSyncingBackend()) { |
2480 backend_->UnregisterInvalidationIds(); | 2482 backend_->UnregisterInvalidationIds(); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2753 | 2755 |
2754 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { | 2756 base::MessageLoop* ProfileSyncService::GetSyncLoopForTest() const { |
2755 if (sync_thread_) { | 2757 if (sync_thread_) { |
2756 return sync_thread_->message_loop(); | 2758 return sync_thread_->message_loop(); |
2757 } else if (backend_) { | 2759 } else if (backend_) { |
2758 return backend_->GetSyncLoopForTesting(); | 2760 return backend_->GetSyncLoopForTesting(); |
2759 } else { | 2761 } else { |
2760 return NULL; | 2762 return NULL; |
2761 } | 2763 } |
2762 } | 2764 } |
OLD | NEW |