Commit b8aae0c6 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Chromium LUCI CQ

Convert c/b/sync_file_system/drive_backend/ to OnPrimaryAccountChanged()

Methods OnPrimaryAccountSet/Cleared() are deprecated, so this CL changes
the chrome/browser/sync_file_system/drive_backend/* to override the
method OnPrimaryAccountChanged().

Bug: 1163126
Change-Id: Ib619c24eff3778cf658acfef90009e240d7cea09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611088
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Auto-Submit: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840964}
parent cb7c16aa
......@@ -29,6 +29,8 @@
#include "storage/browser/quota/quota_manager.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
using signin::PrimaryAccountChangeEvent;
namespace sync_file_system {
namespace {
......@@ -125,11 +127,6 @@ class SyncFileSystemTest : public extensions::PlatformAppBrowserTest,
void SignIn() {
identity_test_env_->SetPrimaryAccount(kEmail);
// It's necessary to invoke this method manually as the observer callback is
// not triggered on ChromeOS.
sync_engine()->OnPrimaryAccountSet(
identity_test_env_->identity_manager()->GetPrimaryAccountInfo());
}
void SetSyncEnabled(bool enabled) {
......@@ -184,8 +181,11 @@ IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) {
// service. Wait for the completion and resume the app.
WaitUntilIdle();
sync_engine()->OnPrimaryAccountCleared(
identity_manager()->GetPrimaryAccountInfo());
sync_engine()->OnPrimaryAccountChanged(
PrimaryAccountChangeEvent(PrimaryAccountChangeEvent::State(
identity_manager()->GetPrimaryAccountInfo(),
signin::ConsentLevel::kSync),
PrimaryAccountChangeEvent::State()));
foo_created.Reply("resume");
ASSERT_TRUE(bar_created.WaitUntilSatisfied());
......@@ -198,8 +198,11 @@ IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) {
EXPECT_EQ(REMOTE_SERVICE_AUTHENTICATION_REQUIRED,
sync_engine()->GetCurrentState());
sync_engine()->OnPrimaryAccountSet(
identity_manager()->GetPrimaryAccountInfo());
sync_engine()->OnPrimaryAccountChanged(
PrimaryAccountChangeEvent(PrimaryAccountChangeEvent::State(),
PrimaryAccountChangeEvent::State(
identity_manager()->GetPrimaryAccountInfo(),
signin::ConsentLevel::kSync)));
WaitUntilIdle();
bar_created.Reply("resume");
......
......@@ -710,16 +710,20 @@ void SyncEngine::OnConnectionChanged(network::mojom::ConnectionType type) {
}
}
void SyncEngine::OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) {
void SyncEngine::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event_details) {
switch (event_details.GetEventTypeFor(signin::ConsentLevel::kSync)) {
case signin::PrimaryAccountChangeEvent::Type::kSet:
Initialize();
}
void SyncEngine::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) {
return;
case signin::PrimaryAccountChangeEvent::Type::kCleared:
Reset();
UpdateServiceState(REMOTE_SERVICE_AUTHENTICATION_REQUIRED,
"User signed out.");
return;
case signin::PrimaryAccountChangeEvent::Type::kNone:
return;
}
}
SyncEngine::SyncEngine(
......
......@@ -145,10 +145,8 @@ class SyncEngine
void OnConnectionChanged(network::mojom::ConnectionType type) override;
// IdentityManager::Observer overrides.
void OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) override;
void OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) override;
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override;
private:
class WorkerObserver;
......
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