Commit dee2f4af authored by Boris Sazonov's avatar Boris Sazonov Committed by Chromium LUCI CQ

Replace AccountManagerFacadeAsh with AccountManagerFacadeImpl

Changes account_manager_facade_factory_ash.cc so that it instantiates
AccountManagerFacadeImpl rather than AccountManagerFacadeAsh and removes
AccountManagerFacadeAsh. This completes the unification of
AccountManagerFacade implementations.

Bug: 1161699
Change-Id: I173307bdc584f31af72ef4f34af5c27b71fec435
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626444
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843758}
parent 61bad0a5
...@@ -12,20 +12,20 @@ ...@@ -12,20 +12,20 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/browser_process_platform_part_chromeos.h"
#include "chromeos/components/account_manager/account_manager.h" #include "chromeos/components/account_manager/account_manager.h"
#include "chromeos/components/account_manager/account_manager_facade_ash.h"
#include "chromeos/components/account_manager/account_manager_factory.h" #include "chromeos/components/account_manager/account_manager_factory.h"
#include "components/account_manager_core/account_manager_facade_impl.h"
namespace { namespace {
// TODO(sinhak): Move ownership of AccountManager and remove this method. crosapi::AccountManagerAsh* GetAccountManagerAsh(
chromeos::AccountManager* GetAccountManager(const std::string& profile_path) { const std::string& profile_path) {
chromeos::AccountManager* account_manager = crosapi::AccountManagerAsh* account_manager_ash =
g_browser_process->platform_part() g_browser_process->platform_part()
->GetAccountManagerFactory() ->GetAccountManagerFactory()
->GetAccountManager(profile_path); ->GetAccountManagerAsh(profile_path);
DCHECK(account_manager); DCHECK(account_manager_ash);
return account_manager; return account_manager_ash;
} }
} // namespace } // namespace
...@@ -34,15 +34,17 @@ account_manager::AccountManagerFacade* GetAccountManagerFacade( ...@@ -34,15 +34,17 @@ account_manager::AccountManagerFacade* GetAccountManagerFacade(
const std::string& profile_path) { const std::string& profile_path) {
// Map from |profile_path| to AccountManagerFacade. // Map from |profile_path| to AccountManagerFacade.
static base::NoDestructor< static base::NoDestructor<
std::map<std::string, std::unique_ptr<chromeos::AccountManagerFacadeAsh>>> std::map<std::string, std::unique_ptr<AccountManagerFacadeImpl>>>
account_manager_facade_map; account_manager_facade_map;
auto it = account_manager_facade_map->find(profile_path); auto it = account_manager_facade_map->find(profile_path);
if (it == account_manager_facade_map->end()) { if (it == account_manager_facade_map->end()) {
mojo::Remote<crosapi::mojom::AccountManager> remote;
GetAccountManagerAsh(profile_path)
->BindReceiver(remote.BindNewPipeAndPassReceiver());
it = account_manager_facade_map it = account_manager_facade_map
->emplace(profile_path, ->emplace(profile_path, std::make_unique<AccountManagerFacadeImpl>(
std::make_unique<chromeos::AccountManagerFacadeAsh>( std::move(remote)))
GetAccountManager(profile_path)))
.first; .first;
} }
......
...@@ -12,8 +12,6 @@ component("account_manager") { ...@@ -12,8 +12,6 @@ component("account_manager") {
"account_manager.h", "account_manager.h",
"account_manager_ash.cc", "account_manager_ash.cc",
"account_manager_ash.h", "account_manager_ash.h",
"account_manager_facade_ash.cc",
"account_manager_facade_ash.h",
"account_manager_factory.cc", "account_manager_factory.cc",
"account_manager_factory.h", "account_manager_factory.h",
"account_manager_ui.cc", "account_manager_ui.cc",
......
// Copyright 2020 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.
#include "chromeos/components/account_manager/account_manager_facade_ash.h"
#include "chromeos/components/account_manager/account_manager.h"
namespace chromeos {
AccountManagerFacadeAsh::AccountManagerFacadeAsh(
AccountManager* account_manager)
: account_manager_(account_manager) {}
AccountManagerFacadeAsh::~AccountManagerFacadeAsh() = default;
bool AccountManagerFacadeAsh::IsInitialized() {
return account_manager_->IsInitialized();
}
void AccountManagerFacadeAsh::ShowAddAccountDialog(
const AccountAdditionSource& source,
base::OnceCallback<void(const AccountAdditionResult& result)> callback) {
// TODO(crbug.com/1140469): implement this.
}
void AccountManagerFacadeAsh::ShowReauthAccountDialog(
const AccountAdditionSource& source,
const std::string& email) {
// TODO(crbug.com/1140469): implement this.
}
} // namespace chromeos
// Copyright 2020 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.
#ifndef CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_
#define CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_
#include "components/account_manager_core/account_manager_facade.h"
namespace chromeos {
class AccountManager;
// Ash-chrome specific implementation of |AccountManagerFacade| that talks to
// |chromeos::AccountManager| in-process.
class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerFacadeAsh
: public ::account_manager::AccountManagerFacade {
public:
explicit AccountManagerFacadeAsh(AccountManager* account_manager);
AccountManagerFacadeAsh(const AccountManagerFacadeAsh&) = delete;
AccountManagerFacadeAsh& operator=(const AccountManagerFacadeAsh&) = delete;
~AccountManagerFacadeAsh() override;
// AccountManagerFacade overrides:
bool IsInitialized() override;
void ShowAddAccountDialog(
const AccountAdditionSource& source,
base::OnceCallback<void(const AccountAdditionResult& result)> callback)
override;
void ShowReauthAccountDialog(const AccountAdditionSource& source,
const std::string& email) override;
private:
AccountManager* const account_manager_;
};
} // namespace chromeos
#endif // CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
namespace chromeos { namespace chromeos {
// This interface is used by `AccountManagerFacadeAsh` to show system UI (system // This interface is used by `AccountManagerFacadeImpl` to show system UI
// dialogs, OS Settings etc.) // (system dialogs, OS Settings etc.)
class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerUI { class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerUI {
public: public:
AccountManagerUI(); AccountManagerUI();
......
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