| 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 <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/string16.h" | 21 #include "base/string16.h" |
| 22 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
| 23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "chrome/browser/about_flags.h" | 25 #include "chrome/browser/about_flags.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/defaults.h" | 27 #include "chrome/browser/defaults.h" |
| 28 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 28 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 29 #include "chrome/browser/prefs/pref_service_syncable.h" | 29 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/signin/about_signin_internals.h" |
| 32 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 31 #include "chrome/browser/signin/signin_manager.h" | 33 #include "chrome/browser/signin/signin_manager.h" |
| 32 #include "chrome/browser/signin/signin_manager_factory.h" | 34 #include "chrome/browser/signin/signin_manager_factory.h" |
| 33 #include "chrome/browser/signin/token_service.h" | 35 #include "chrome/browser/signin/token_service.h" |
| 34 #include "chrome/browser/signin/token_service_factory.h" | 36 #include "chrome/browser/signin/token_service_factory.h" |
| 35 #include "chrome/browser/sync/backend_migrator.h" | 37 #include "chrome/browser/sync/backend_migrator.h" |
| 36 #include "chrome/browser/sync/glue/change_processor.h" | 38 #include "chrome/browser/sync/glue/change_processor.h" |
| 37 #include "chrome/browser/sync/glue/chrome_encryptor.h" | 39 #include "chrome/browser/sync/glue/chrome_encryptor.h" |
| 38 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 40 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
| 39 #include "chrome/browser/sync/glue/data_type_controller.h" | 41 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 40 #include "chrome/browser/sync/glue/device_info.h" | 42 #include "chrome/browser/sync/glue/device_info.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 417 } |
| 416 } | 418 } |
| 417 } | 419 } |
| 418 | 420 |
| 419 SyncCredentials ProfileSyncService::GetCredentials() { | 421 SyncCredentials ProfileSyncService::GetCredentials() { |
| 420 SyncCredentials credentials; | 422 SyncCredentials credentials; |
| 421 credentials.email = signin_->GetAuthenticatedUsername(); | 423 credentials.email = signin_->GetAuthenticatedUsername(); |
| 422 DCHECK(!credentials.email.empty()); | 424 DCHECK(!credentials.email.empty()); |
| 423 TokenService* service = TokenServiceFactory::GetForProfile(profile_); | 425 TokenService* service = TokenServiceFactory::GetForProfile(profile_); |
| 424 if (service->HasTokenForService(GaiaConstants::kSyncService)) { | 426 if (service->HasTokenForService(GaiaConstants::kSyncService)) { |
| 425 credentials.sync_token = service->GetTokenForService( | 427 credentials.sync_token = service->GetTokenForService( |
| 426 GaiaConstants::kSyncService); | 428 GaiaConstants::kSyncService); |
| 429 credentials.sync_token_time = |
| 430 AboutSigninInternalsFactory::GetForProfile(profile_)-> |
| 431 GetTokenTime(GaiaConstants::kSyncService); |
| 427 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", false); | 432 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", false); |
| 428 } else { | 433 } else { |
| 429 // We've lost our sync credentials (crbug.com/121755), so just make up some | 434 // We've lost our sync credentials (crbug.com/121755), so just make up some |
| 430 // invalid credentials so the backend will generate an auth error. | 435 // invalid credentials so the backend will generate an auth error. |
| 431 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", true); | 436 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", true); |
| 432 credentials.sync_token = "credentials_lost"; | 437 credentials.sync_token = "credentials_lost"; |
| 433 } | 438 } |
| 434 return credentials; | 439 return credentials; |
| 435 } | 440 } |
| 436 | 441 |
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 2104 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
| 2100 ProfileSyncService* old_this = this; | 2105 ProfileSyncService* old_this = this; |
| 2101 this->~ProfileSyncService(); | 2106 this->~ProfileSyncService(); |
| 2102 new(old_this) ProfileSyncService( | 2107 new(old_this) ProfileSyncService( |
| 2103 new ProfileSyncComponentsFactoryImpl(profile, | 2108 new ProfileSyncComponentsFactoryImpl(profile, |
| 2104 CommandLine::ForCurrentProcess()), | 2109 CommandLine::ForCurrentProcess()), |
| 2105 profile, | 2110 profile, |
| 2106 signin, | 2111 signin, |
| 2107 behavior); | 2112 behavior); |
| 2108 } | 2113 } |
| OLD | NEW |