summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r--chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc2
-rw-r--r--chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc2
-rw-r--r--chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc2
-rw-r--r--chrome/browser/sync/profile_sync_service_autofill_unittest.cc2
-rw-r--r--chrome/browser/sync/profile_sync_service_harness.cc13
-rw-r--r--chrome/browser/sync/profile_sync_service_password_unittest.cc2
-rw-r--r--chrome/browser/sync/profile_sync_service_typed_url_unittest.cc2
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc4
-rw-r--r--chrome/browser/sync/sync_ui_util.cc4
-rw-r--r--chrome/browser/sync/sync_ui_util_mac.mm7
-rw-r--r--chrome/browser/sync/test/integration/passwords_helper.cc5
-rw-r--r--chrome/browser/sync/test/integration/sessions_helper.cc21
12 files changed, 37 insertions, 29 deletions
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
index 8627fea..9640e35 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
@@ -123,8 +123,6 @@ class AutofillDataTypeControllerTest : public testing::Test {
db_thread_.DeprecatedGetThreadObject());
db_notification_service_->Init();
web_data_service_ = new WebDataServiceFake();
- EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
- Return(&service_));
autofill_dtc_ =
new AutofillDataTypeControllerMock(&profile_sync_factory_,
&profile_,
diff --git a/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc
index 4517981..ab80ada 100644
--- a/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/new_non_frontend_data_type_controller_unittest.cc
@@ -126,8 +126,6 @@ class NewNonFrontendDataTypeControllerTest : public testing::Test {
db_thread_(BrowserThread::DB) {}
virtual void SetUp() OVERRIDE {
- EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
- Return(&service_));
EXPECT_CALL(service_, GetUserShare()).WillRepeatedly(
Return((sync_api::UserShare*)NULL));
db_thread_.Start();
diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc
index 6d7c4aa..01d208b 100644
--- a/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc
@@ -112,8 +112,6 @@ class NonFrontendDataTypeControllerTest : public testing::Test {
change_processor_(NULL) {}
virtual void SetUp() {
- EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
- Return(&service_));
db_thread_.Start();
profile_sync_factory_.reset(
new StrictMock<ProfileSyncComponentsFactoryMock>());
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index 75fec91..466fa03 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -411,8 +411,6 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
ProfileSyncService::AUTO_START,
false,
callback));
- EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
- Return(service_.get()));
DataTypeController* data_type_controller =
factory->CreateDataTypeController(components_factory,
&profile_,
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 5e4d856..34b6124 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sessions/session_state.h"
#include "chrome/browser/sync/sync_ui_util.h"
@@ -107,7 +108,8 @@ ProfileSyncServiceHarness::ProfileSyncServiceHarness(
password_(password),
profile_debug_name_(profile->GetDebugName()) {
if (IsSyncAlreadySetup()) {
- service_ = profile_->GetProfileSyncService();
+ service_ = ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ profile_);
service_->AddObserver(this);
ignore_result(TryListeningToMigrationEvents());
wait_state_ = FULLY_SYNCED;
@@ -119,7 +121,8 @@ ProfileSyncServiceHarness::~ProfileSyncServiceHarness() {}
// static
ProfileSyncServiceHarness* ProfileSyncServiceHarness::CreateAndAttach(
Profile* profile) {
- if (!profile->HasProfileSyncService()) {
+ if (ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
+ profile)) {
NOTREACHED() << "Profile has never signed into sync.";
return NULL;
}
@@ -133,7 +136,8 @@ void ProfileSyncServiceHarness::SetCredentials(const std::string& username,
}
bool ProfileSyncServiceHarness::IsSyncAlreadySetup() {
- return profile_->HasProfileSyncService();
+ return ProfileSyncServiceFactory::GetInstance()->HasProfileSyncService(
+ profile_);
}
bool ProfileSyncServiceHarness::SetupSync() {
@@ -151,7 +155,8 @@ bool ProfileSyncServiceHarness::SetupSync() {
bool ProfileSyncServiceHarness::SetupSync(
syncable::ModelTypeSet synced_datatypes) {
// Initialize the sync client's profile sync service object.
- service_ = profile_->GetProfileSyncService();
+ service_ =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
if (service_ == NULL) {
LOG(ERROR) << "SetupSync(): service_ is null.";
return false;
diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc
index 0b2bbf0..d8d481d 100644
--- a/chrome/browser/sync/profile_sync_service_password_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc
@@ -227,8 +227,6 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
service_->GetPreferredDataTypes();
preferred_types.Put(syncable::PASSWORDS);
service_->ChangePreferredDataTypes(preferred_types);
- EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
- Return(service_.get()));
PasswordDataTypeController* data_type_controller =
new PasswordDataTypeController(factory,
&profile_,
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index 6e71108..34012a7 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -193,8 +193,6 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
ProfileSyncService::AUTO_START,
false,
callback));
- EXPECT_CALL(profile_, GetProfileSyncService()).WillRepeatedly(
- Return(service_.get()));
TypedUrlDataTypeController* data_type_controller =
new TypedUrlDataTypeController(factory,
&profile_,
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index c1abbee..67e0a5a 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sync_setup_flow_handler.h"
#include "chrome/browser/sync/syncable/model_type.h"
#include "chrome/browser/sync/user_selectable_sync_type.h"
@@ -79,7 +80,8 @@ bool HasConfigurationChanged(const SyncConfiguration& configuration,
UpdateCustomConfigHistogram);
// If service is null or if this is a first time configuration, return true.
- ProfileSyncService* service = profile->GetProfileSyncService();
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
if (!service || !service->HasSyncSetupCompleted())
return true;
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc
index 3dd7571..2775d4d 100644
--- a/chrome/browser/sync/sync_ui_util.cc
+++ b/chrome/browser/sync/sync_ui_util.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/protocol/proto_enum_conversions.h"
#include "chrome/browser/sync/protocol/sync_protocol_error.h"
#include "chrome/browser/sync/syncable/model_type.h"
@@ -427,7 +428,8 @@ void OpenSyncMyBookmarksDialog(Profile* profile,
Browser* browser,
ProfileSyncService::SyncEventCodes code) {
ProfileSyncService* service =
- profile->GetOriginalProfile()->GetProfileSyncService();
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ profile->GetOriginalProfile());
if (!service || !service->IsSyncEnabled()) {
LOG(DFATAL) << "OpenSyncMyBookmarksDialog called with sync disabled";
return;
diff --git a/chrome/browser/sync/sync_ui_util_mac.mm b/chrome/browser/sync/sync_ui_util_mac.mm
index 6cc6ff6..322c1ca 100644
--- a/chrome/browser/sync/sync_ui_util_mac.mm
+++ b/chrome/browser/sync/sync_ui_util_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,8 @@
#include "base/logging.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/pref_names.h"
#include "grit/chromium_strings.h"
@@ -25,7 +27,8 @@ namespace sync_ui_util {
void UpdateSyncItem(id syncItem, BOOL syncEnabled, Profile* profile) {
ProfileSyncService* syncService =
- profile->GetOriginalProfile()->GetProfileSyncService();
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ profile->GetOriginalProfile());
UpdateSyncItemForStatus(
syncItem,
syncEnabled,
diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc
index f2cf8ab..7c550a2 100644
--- a/chrome/browser/sync/test/integration/passwords_helper.cc
+++ b/chrome/browser/sync/test/integration/passwords_helper.cc
@@ -11,6 +11,8 @@
#include "chrome/browser/password_manager/password_form_data.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/password_manager/password_store_consumer.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -106,7 +108,8 @@ void RemoveLogins(PasswordStore* store) {
}
void SetPassphrase(int index, const std::string& passphrase) {
- test()->GetProfile(index)->GetProfileSyncService()->SetPassphrase(
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ test()->GetProfile(index))->SetPassphrase(
passphrase,
ProfileSyncService::EXPLICIT,
ProfileSyncService::USER_PROVIDED);
diff --git a/chrome/browser/sync/test/integration/sessions_helper.cc b/chrome/browser/sync/test/integration/sessions_helper.cc
index 7546f44..886dbee 100644
--- a/chrome/browser/sync/test/integration/sessions_helper.cc
+++ b/chrome/browser/sync/test/integration/sessions_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/session_model_associator.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
@@ -50,8 +51,9 @@ void ScopedWindowMap::Reset(SessionWindowMap* windows) {
}
bool GetLocalSession(int index, const browser_sync::SyncedSession** session) {
- return test()->GetProfile(index)->GetProfileSyncService()->
- GetSessionModelAssociator()->GetLocalSession(session);
+ return ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ test()->GetProfile(index))->GetSessionModelAssociator()->GetLocalSession(
+ session);
}
bool ModelAssociatorHasTabWithUrl(int index, const GURL& url) {
@@ -134,8 +136,8 @@ bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls) {
return false;
}
if (!found) {
- test()->GetProfile(index)->GetProfileSyncService()->
- GetSessionModelAssociator()->
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ test()->GetProfile(index))->GetSessionModelAssociator()->
BlockUntilLocalChangeForTest(timeout_milli);
ui_test_utils::RunMessageLoop();
}
@@ -197,14 +199,16 @@ int GetNumWindows(int index) {
int GetNumForeignSessions(int index) {
SyncedSessionVector sessions;
- if (!test()->GetProfile(index)->GetProfileSyncService()->
+ if (!ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ test()->GetProfile(index))->
GetSessionModelAssociator()->GetAllForeignSessions(&sessions))
return 0;
return sessions.size();
}
bool GetSessionData(int index, SyncedSessionVector* sessions) {
- if (!test()->GetProfile(index)->GetProfileSyncService()->
+ if (!ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ test()->GetProfile(index))->
GetSessionModelAssociator()->GetAllForeignSessions(sessions))
return false;
SortSyncedSessions(sessions);
@@ -304,7 +308,8 @@ bool CheckForeignSessionsAgainst(
}
void DeleteForeignSession(int index, std::string session_tag) {
- test()->GetProfile(index)->GetProfileSyncService()->
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ test()->GetProfile(index))->
GetSessionModelAssociator()->DeleteForeignSession(session_tag);
}