summaryrefslogtreecommitdiff
path: root/chrome/browser/sync/profile_sync_service.cc
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-10-18 15:46:22 +0100
committerTorne (Richard Coles) <torne@google.com>2013-10-18 15:46:22 +0100
commit4e180b6a0b4720a9b8e9e959a882386f690f08ff (patch)
tree788435d09362885908ba5ba9ef868b852ca82c0b /chrome/browser/sync/profile_sync_service.cc
parent1179b92b08db0c652a0cf003ab4d89b31ce3610f (diff)
downloadchromium_org-4e180b6a0b4720a9b8e9e959a882386f690f08ff.tar.gz
Merge from Chromium at DEPS revision 228962
This commit was generated by merge_to_master.py. Change-Id: I23bd7d7766f213fd52f28ae5e1ecc6ae9df905ea
Diffstat (limited to 'chrome/browser/sync/profile_sync_service.cc')
-rw-r--r--chrome/browser/sync/profile_sync_service.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 38a4feed3f..bbeed23e6d 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/signin/about_signin_internals.h"
#include "chrome/browser/signin/about_signin_internals_factory.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/token_service.h"
@@ -166,7 +167,6 @@ ProfileSyncService::ProfileSyncService(
is_auth_in_progress_(false),
signin_(signin_manager),
unrecoverable_error_reason_(ERROR_REASON_UNSET),
- weak_factory_(this),
expect_sync_configuration_aborted_(false),
encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()),
encrypt_everything_(false),
@@ -176,7 +176,8 @@ ProfileSyncService::ProfileSyncService(
setup_in_progress_(false),
use_oauth2_token_(false),
oauth2_token_service_(oauth2_token_service),
- request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy) {
+ request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy),
+ weak_factory_(this) {
// By default, dev, canary, and unbranded Chromium users will go to the
// development servers. Development servers have more features than standard
// sync servers. Users with officially-branded Chrome stable and beta builds
@@ -419,6 +420,17 @@ ScopedVector<browser_sync::DeviceInfo>
return devices.Pass();
}
+std::string ProfileSyncService::GetLocalDeviceGUID() const {
+ if (backend_) {
+ browser_sync::SyncedDeviceTracker* device_tracker =
+ backend_->GetSyncedDeviceTracker();
+ if (device_tracker) {
+ return device_tracker->cache_guid();
+ }
+ }
+ return std::string();
+}
+
// Notifies the observer of any device info changes.
void ProfileSyncService::AddObserverForDeviceInfoChange(
browser_sync::SyncedDeviceTracker::Observer* observer) {
@@ -804,6 +816,7 @@ void ProfileSyncService::ShutdownImpl(
is_auth_in_progress_ = false;
backend_initialized_ = false;
cached_passphrase_.clear();
+ access_token_.clear();
encryption_pending_ = false;
encrypt_everything_ = false;
encrypted_types_ = syncer::SyncEncryptionHandler::SensitiveTypes();
@@ -1096,7 +1109,7 @@ void ProfileSyncService::UpdateAuthErrorState(const AuthError& error) {
// Fan the notification out to interested UI-thread components. Notify the
// SigninGlobalError first so it reflects the latest auth state before we
// notify observers.
- if (profile_)
+ if (profile_ && !use_oauth2_token_)
SigninGlobalError::GetForProfile(profile_)->AuthStatusChanged();
NotifyObservers();
@@ -1448,6 +1461,11 @@ const AuthError& ProfileSyncService::GetAuthError() const {
return last_auth_error_;
}
+std::string ProfileSyncService::GetAccountId() const {
+ return ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->
+ GetPrimaryAccountId();
+}
+
GoogleServiceAuthError ProfileSyncService::GetAuthStatus() const {
// If waiting_for_auth() returns true, it means that ProfileSyncService has
// detected that the user has just successfully completed gaia signin, but the
@@ -1538,7 +1556,7 @@ const browser_sync::user_selectable_type::UserSelectableSyncType
browser_sync::user_selectable_type::PROXY_TABS
};
- COMPILE_ASSERT(28 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram);
+ COMPILE_ASSERT(29 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram);
if (!sync_everything) {
const syncer::ModelTypeSet current_types = GetPreferredDataTypes();