Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 12502017: signin: pull basic SigninManager functionality into new SigninManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: megarebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 bool ShouldShowActionOnUI( 125 bool ShouldShowActionOnUI(
126 const syncer::SyncProtocolError& error) { 126 const syncer::SyncProtocolError& error) {
127 return (error.action != syncer::UNKNOWN_ACTION && 127 return (error.action != syncer::UNKNOWN_ACTION &&
128 error.action != syncer::DISABLE_SYNC_ON_CLIENT); 128 error.action != syncer::DISABLE_SYNC_ON_CLIENT);
129 } 129 }
130 130
131 ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, 131 ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory,
132 Profile* profile, 132 Profile* profile,
133 SigninManager* signin_manager, 133 SigninManagerBase* signin_manager,
134 StartBehavior start_behavior) 134 StartBehavior start_behavior)
135 : last_auth_error_(AuthError::AuthErrorNone()), 135 : last_auth_error_(AuthError::AuthErrorNone()),
136 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), 136 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED),
137 factory_(factory), 137 factory_(factory),
138 profile_(profile), 138 profile_(profile),
139 // |profile| may be NULL in unit tests. 139 // |profile| may be NULL in unit tests.
140 sync_prefs_(profile_ ? profile_->GetPrefs() : NULL), 140 sync_prefs_(profile_ ? profile_->GetPrefs() : NULL),
141 invalidator_storage_(profile_ ? profile_->GetPrefs(): NULL), 141 invalidator_storage_(profile_ ? profile_->GetPrefs(): NULL),
142 sync_service_url_(kDevServerUrl), 142 sync_service_url_(kDevServerUrl),
143 is_first_time_sync_configure_(false), 143 is_first_time_sync_configure_(false),
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 invalidator_state_ : syncer::TRANSIENT_INVALIDATION_ERROR; 2036 invalidator_state_ : syncer::TRANSIENT_INVALIDATION_ERROR;
2037 DVLOG(1) << "New invalidator state: " 2037 DVLOG(1) << "New invalidator state: "
2038 << syncer::InvalidatorStateToString(invalidator_state_) 2038 << syncer::InvalidatorStateToString(invalidator_state_)
2039 << ", effective state: " 2039 << ", effective state: "
2040 << syncer::InvalidatorStateToString(effective_state); 2040 << syncer::InvalidatorStateToString(effective_state);
2041 invalidator_registrar_->UpdateInvalidatorState(effective_state); 2041 invalidator_registrar_->UpdateInvalidatorState(effective_state);
2042 } 2042 }
2043 2043
2044 void ProfileSyncService::ResetForTest() { 2044 void ProfileSyncService::ResetForTest() {
2045 Profile* profile = profile_; 2045 Profile* profile = profile_;
2046 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); 2046 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile);
2047 ProfileSyncService::StartBehavior behavior = 2047 ProfileSyncService::StartBehavior behavior =
2048 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START 2048 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START
2049 : ProfileSyncService::MANUAL_START; 2049 : ProfileSyncService::MANUAL_START;
2050 2050
2051 // We call the destructor and placement new here because we want to explicitly 2051 // We call the destructor and placement new here because we want to explicitly
2052 // recreate a new ProfileSyncService instance at the same memory location as 2052 // recreate a new ProfileSyncService instance at the same memory location as
2053 // the old one. Doing so is fine because this code is run only from within 2053 // the old one. Doing so is fine because this code is run only from within
2054 // integration tests, and the message loop is not running at this point. 2054 // integration tests, and the message loop is not running at this point.
2055 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 2055 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
2056 ProfileSyncService* old_this = this; 2056 ProfileSyncService* old_this = this;
2057 this->~ProfileSyncService(); 2057 this->~ProfileSyncService();
2058 new(old_this) ProfileSyncService( 2058 new(old_this) ProfileSyncService(
2059 new ProfileSyncComponentsFactoryImpl(profile, 2059 new ProfileSyncComponentsFactoryImpl(profile,
2060 CommandLine::ForCurrentProcess()), 2060 CommandLine::ForCurrentProcess()),
2061 profile, 2061 profile,
2062 signin, 2062 signin,
2063 behavior); 2063 behavior);
2064 } 2064 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698