| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 411 } |
| 410 } | 412 } |
| 411 } | 413 } |
| 412 | 414 |
| 413 SyncCredentials ProfileSyncService::GetCredentials() { | 415 SyncCredentials ProfileSyncService::GetCredentials() { |
| 414 SyncCredentials credentials; | 416 SyncCredentials credentials; |
| 415 credentials.email = signin_->GetAuthenticatedUsername(); | 417 credentials.email = signin_->GetAuthenticatedUsername(); |
| 416 DCHECK(!credentials.email.empty()); | 418 DCHECK(!credentials.email.empty()); |
| 417 TokenService* service = TokenServiceFactory::GetForProfile(profile_); | 419 TokenService* service = TokenServiceFactory::GetForProfile(profile_); |
| 418 if (service->HasTokenForService(GaiaConstants::kSyncService)) { | 420 if (service->HasTokenForService(GaiaConstants::kSyncService)) { |
| 419 credentials.sync_token = service->GetTokenForService( | 421 credentials.sync_token = service->GetTokenForService( |
| 420 GaiaConstants::kSyncService); | 422 GaiaConstants::kSyncService); |
| 423 credentials.sync_token_time = |
| 424 AboutSigninInternalsFactory::GetForProfile(profile_)-> |
| 425 GetTokenTime(GaiaConstants::kSyncService); |
| 421 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", false); | 426 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", false); |
| 422 } else { | 427 } else { |
| 423 // We've lost our sync credentials (crbug.com/121755), so just make up some | 428 // We've lost our sync credentials (crbug.com/121755), so just make up some |
| 424 // invalid credentials so the backend will generate an auth error. | 429 // invalid credentials so the backend will generate an auth error. |
| 425 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", true); | 430 UMA_HISTOGRAM_BOOLEAN("Sync.CredentialsLost", true); |
| 426 credentials.sync_token = "credentials_lost"; | 431 credentials.sync_token = "credentials_lost"; |
| 427 } | 432 } |
| 428 return credentials; | 433 return credentials; |
| 429 } | 434 } |
| 430 | 435 |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 2063 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
| 2059 ProfileSyncService* old_this = this; | 2064 ProfileSyncService* old_this = this; |
| 2060 this->~ProfileSyncService(); | 2065 this->~ProfileSyncService(); |
| 2061 new(old_this) ProfileSyncService( | 2066 new(old_this) ProfileSyncService( |
| 2062 new ProfileSyncComponentsFactoryImpl(profile, | 2067 new ProfileSyncComponentsFactoryImpl(profile, |
| 2063 CommandLine::ForCurrentProcess()), | 2068 CommandLine::ForCurrentProcess()), |
| 2064 profile, | 2069 profile, |
| 2065 signin, | 2070 signin, |
| 2066 behavior); | 2071 behavior); |
| 2067 } | 2072 } |
| OLD | NEW |