Commit 3f9b3e12 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Sync: don't expose SigninManager from SyncService

As a first (baby) step of removing the old signin APIs from Sync.

Bug: 825190
Change-Id: I1554c96c54555083f06963a72d2c38248afeb960
Reviewed-on: https://chromium-review.googlesource.com/978186Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546065}
parent bc09d4d5
......@@ -281,8 +281,8 @@ bool ProfileSyncServiceHarness::RestartSyncService() {
void ProfileSyncServiceHarness::SignoutSyncService() {
DCHECK(!username_.empty());
service()->GoogleSignedOut(service()->signin()->GetAuthenticatedAccountId(),
username_);
service()->GoogleSignedOut(
service()->GetAuthenticatedAccountInfo().account_id, username_);
}
bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion(
......
......@@ -428,7 +428,8 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
// want to block here and not create the HistogramTester below until we know
// the cookie jar stats have been updated.
UpdateCookieJarAccountsAndWait(
{GetClient(0)->service()->signin()->GetAuthenticatedAccountId()}, false);
{GetClient(0)->service()->GetAuthenticatedAccountInfo().account_id},
false);
{
HistogramTester histogram_tester;
......
......@@ -336,14 +336,14 @@ void ProfileSyncService::StartSyncingWithServer() {
void ProfileSyncService::RegisterAuthNotifications() {
DCHECK(thread_checker_.CalledOnValidThread());
oauth2_token_service_->AddObserver(this);
if (signin())
signin()->AddObserver(this);
if (signin_)
signin_->GetOriginal()->AddObserver(this);
}
void ProfileSyncService::UnregisterAuthNotifications() {
DCHECK(thread_checker_.CalledOnValidThread());
if (signin())
signin()->RemoveObserver(this);
if (signin_)
signin_->GetOriginal()->RemoveObserver(this);
if (oauth2_token_service_)
oauth2_token_service_->RemoveObserver(this);
}
......
......@@ -783,6 +783,7 @@ static_library("test_support_driver") {
deps = [
":sync",
":test_support_engine",
"//components/signin/core/browser:account_info",
"//components/sync_preferences:test_support",
"//components/version_info",
"//google_apis",
......
......@@ -12,7 +12,6 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/driver/sync_service.h"
#include "components/sync/engine/cycle/sync_cycle_snapshot.h"
......@@ -245,11 +244,8 @@ std::string GetConnectionStatus(const SyncService::SyncTokenStatus& status) {
std::unique_ptr<base::DictionaryValue> ConstructAboutInformation_DEPRECATED(
SyncService* service,
version_info::Channel channel) {
AccountInfo primary_account_info;
if (service->signin())
primary_account_info = service->signin()->GetAuthenticatedAccountInfo();
return ConstructAboutInformation(service, primary_account_info, channel);
return ConstructAboutInformation(
service, service->GetAuthenticatedAccountInfo(), channel);
}
// This function both defines the structure of the message to be returned and
......
......@@ -5,6 +5,7 @@
#include "components/sync/driver/fake_sync_service.h"
#include "base/values.h"
#include "components/signin/core/browser/account_info.h"
#include "components/sync/driver/data_type_controller.h"
#include "components/sync/syncable/base_transaction.h"
#include "components/sync/syncable/user_share.h"
......@@ -204,8 +205,8 @@ base::WeakPtr<JsController> FakeSyncService::GetJsController() {
void FakeSyncService::GetAllNodes(
const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) {}
SigninManagerBase* FakeSyncService::signin() const {
return nullptr;
AccountInfo FakeSyncService::GetAuthenticatedAccountInfo() const {
return AccountInfo();
}
GlobalIdMapper* FakeSyncService::GetGlobalIdMapper() const {
......
......@@ -88,7 +88,7 @@ class FakeSyncService : public SyncService {
base::WeakPtr<JsController> GetJsController() override;
void GetAllNodes(const base::Callback<void(std::unique_ptr<base::ListValue>)>&
callback) override;
SigninManagerBase* signin() const override;
AccountInfo GetAuthenticatedAccountInfo() const override;
GlobalIdMapper* GetGlobalIdMapper() const override;
// DataTypeEncryptionHandler implementation.
......
......@@ -20,8 +20,8 @@
#include "components/sync/engine/connection_status.h"
#include "google_apis/gaia/google_service_auth_error.h"
struct AccountInfo;
class GoogleServiceAuthError;
class SigninManagerBase;
namespace sync_sessions {
class OpenTabsUIDelegate;
......@@ -350,9 +350,8 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService {
const base::Callback<void(std::unique_ptr<base::ListValue>)>&
callback) = 0;
// Non-owning pointer to sign in logic that can be used to fetch information
// about the currently signed in user.
virtual SigninManagerBase* signin() const = 0;
// Information about the currently signed in user.
virtual AccountInfo GetAuthenticatedAccountInfo() const = 0;
virtual GlobalIdMapper* GetGlobalIdMapper() const = 0;
......
......@@ -7,12 +7,13 @@
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "base/path_service.h"
#include "base/syslog_logging.h"
#include "components/invalidation/public/invalidation_service.h"
#include "components/signin/core/browser/account_info.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "components/sync/base/report_unrecoverable_error.h"
#include "components/sync/device_info/local_device_info_provider.h"
#include "components/sync/driver/sync_driver_switches.h"
......@@ -82,9 +83,10 @@ bool SyncServiceBase::HasObserver(const SyncServiceObserver* observer) const {
return observers_.HasObserver(observer);
}
SigninManagerBase* SyncServiceBase::signin() const {
AccountInfo SyncServiceBase::GetAuthenticatedAccountInfo() const {
DCHECK(thread_checker_.CalledOnValidThread());
return signin_ ? signin_->GetOriginal() : nullptr;
return signin_ ? signin_->GetOriginal()->GetAuthenticatedAccountInfo()
: AccountInfo();
}
// static
......
......@@ -47,7 +47,7 @@ class SyncServiceBase : public SyncService, public SyncEngineHost {
void AddObserver(SyncServiceObserver* observer) override;
void RemoveObserver(SyncServiceObserver* observer) override;
bool HasObserver(const SyncServiceObserver* observer) const override;
SigninManagerBase* signin() const override;
AccountInfo GetAuthenticatedAccountInfo() const override;
// Given base path (path to profile) formats path to "Sync Data" folder where
// sync engine stores directory database.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment