Commit 8ae44865 authored by Kushagra Sinha's avatar Kushagra Sinha Committed by Commit Bot

Lacros: Move AccountManagerFacade into account_manager_core

Move `AccountManagerFacade` from //chromeos/components/account_manager
to //components/account_manager_core so that it can be depended on by
ash-chrome and lacros-chrome both.

Bug: 1117466
Change-Id: I475c0b18d8ce50698c085d841a014f33016e5a61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494938Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821659}
parent dda5da31
...@@ -7,13 +7,16 @@ ...@@ -7,13 +7,16 @@
#include <string> #include <string>
namespace account_manager {
class AccountManagerFacade; class AccountManagerFacade;
} // namespace account_manager
// A factory function for getting platform specific implementations of // A factory function for getting platform specific implementations of
// |AccountManagerFacade|. // |AccountManagerFacade|.
// Returns the |AccountManagerFacade| for the given |profile_path|. // Returns the |AccountManagerFacade| for the given |profile_path|.
// Note that |AccountManagerFacade| is independent of a |Profile|, and this is // Note that |AccountManagerFacade| is independent of a |Profile|, and this is
// needed only because of Multi-Login on Chrome OS, and will be removed soon. // needed only because of Multi-Login on Chrome OS, and will be removed soon.
AccountManagerFacade* GetAccountManagerFacade(const std::string& profile_path); account_manager::AccountManagerFacade* GetAccountManagerFacade(
const std::string& profile_path);
#endif // CHROME_BROWSER_ACCOUNT_MANAGER_FACADE_FACTORY_H_ #endif // CHROME_BROWSER_ACCOUNT_MANAGER_FACADE_FACTORY_H_
...@@ -30,7 +30,8 @@ chromeos::AccountManager* GetAccountManager(const std::string& profile_path) { ...@@ -30,7 +30,8 @@ chromeos::AccountManager* GetAccountManager(const std::string& profile_path) {
} // namespace } // namespace
AccountManagerFacade* GetAccountManagerFacade(const std::string& profile_path) { account_manager::AccountManagerFacade* GetAccountManagerFacade(
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<chromeos::AccountManagerFacadeAsh>>>
......
include_rules = [
"+components/account_manager_core",
]
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "chrome/browser/lacros/account_manager_facade_lacros.h" #include "chrome/browser/lacros/account_manager_facade_lacros.h"
#include "chromeos/components/account_manager/account_manager_facade.h" #include "components/account_manager_core/account_manager_facade.h"
AccountManagerFacade* GetAccountManagerFacade(const std::string& profile_path) { account_manager::AccountManagerFacade* GetAccountManagerFacade(
const std::string& profile_path) {
// Multi-Login is disabled with Lacros. Always return the same instance. // Multi-Login is disabled with Lacros. Always return the same instance.
static base::NoDestructor<AccountManagerFacadeLacros> facade; static base::NoDestructor<AccountManagerFacadeLacros> facade;
return facade.get(); return facade.get();
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include <memory> #include <memory>
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "chromeos/components/account_manager/account_manager_facade.h"
#include "chromeos/crosapi/mojom/account_manager.mojom.h" #include "chromeos/crosapi/mojom/account_manager.mojom.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver.h"
namespace chromeos { namespace chromeos {
...@@ -19,7 +19,7 @@ class LacrosChromeServiceImpl; ...@@ -19,7 +19,7 @@ class LacrosChromeServiceImpl;
// Lacros specific implementation of |AccountManagerFacade| that talks to // Lacros specific implementation of |AccountManagerFacade| that talks to
// |chromeos::AccountManager|, residing in ash-chrome, over Mojo. // |chromeos::AccountManager|, residing in ash-chrome, over Mojo.
class AccountManagerFacadeLacros class AccountManagerFacadeLacros
: public AccountManagerFacade, : public account_manager::AccountManagerFacade,
public crosapi::mojom::AccountManagerObserver { public crosapi::mojom::AccountManagerObserver {
public: public:
AccountManagerFacadeLacros(); AccountManagerFacadeLacros();
......
...@@ -10,8 +10,6 @@ component("account_manager") { ...@@ -10,8 +10,6 @@ component("account_manager") {
sources = [ sources = [
"account_manager.cc", "account_manager.cc",
"account_manager.h", "account_manager.h",
"account_manager_facade.cc",
"account_manager_facade.h",
"account_manager_facade_ash.cc", "account_manager_facade_ash.cc",
"account_manager_facade_ash.h", "account_manager_facade_ash.h",
"account_manager_factory.cc", "account_manager_factory.cc",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_ #ifndef CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_
#define CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_ #define CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_ASH_H_
#include "chromeos/components/account_manager/account_manager_facade.h" #include "components/account_manager_core/account_manager_facade.h"
namespace chromeos { namespace chromeos {
...@@ -14,7 +14,7 @@ class AccountManager; ...@@ -14,7 +14,7 @@ class AccountManager;
// Ash-chrome specific implementation of |AccountManagerFacade| that talks to // Ash-chrome specific implementation of |AccountManagerFacade| that talks to
// |chromeos::AccountManager| in-process. // |chromeos::AccountManager| in-process.
class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerFacadeAsh class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerFacadeAsh
: public AccountManagerFacade { : public ::account_manager::AccountManagerFacade {
public: public:
explicit AccountManagerFacadeAsh(AccountManager* account_manager); explicit AccountManagerFacadeAsh(AccountManager* account_manager);
AccountManagerFacadeAsh(const AccountManagerFacadeAsh&) = delete; AccountManagerFacadeAsh(const AccountManagerFacadeAsh&) = delete;
......
...@@ -10,6 +10,8 @@ component("account_manager_core") { ...@@ -10,6 +10,8 @@ component("account_manager_core") {
sources = [ sources = [
"account.cc", "account.cc",
"account.h", "account.h",
"account_manager_facade.cc",
"account_manager_facade.h",
] ]
public_deps = public_deps =
......
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chromeos/components/account_manager/account_manager_facade.h" #include "components/account_manager_core/account_manager_facade.h"
namespace account_manager {
AccountManagerFacade::AccountManagerFacade() = default; AccountManagerFacade::AccountManagerFacade() = default;
AccountManagerFacade::~AccountManagerFacade() = default; AccountManagerFacade::~AccountManagerFacade() = default;
} // namespace account_manager
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_H_ #ifndef COMPONENTS_ACCOUNT_MANAGER_CORE_ACCOUNT_MANAGER_FACADE_H_
#define CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_H_ #define COMPONENTS_ACCOUNT_MANAGER_CORE_ACCOUNT_MANAGER_FACADE_H_
#include "base/component_export.h" #include "base/component_export.h"
namespace account_manager {
// An interface to talk to |AccountManager|. // An interface to talk to |AccountManager|.
// Implementations of this interface hide the in-process / out-of-process nature // Implementations of this interface hide the in-process / out-of-process nature
// of this communication. // of this communication.
// Instances of this class are singletons, and are independent of a |Profile|. // Instances of this class are singletons, and are independent of a |Profile|.
// Use |GetAccountManagerFacade()| to get an instance of this class. // Use |GetAccountManagerFacade()| to get an instance of this class.
class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerFacade { class COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) AccountManagerFacade {
public: public:
AccountManagerFacade(); AccountManagerFacade();
AccountManagerFacade(const AccountManagerFacade&) = delete; AccountManagerFacade(const AccountManagerFacade&) = delete;
...@@ -26,4 +28,6 @@ class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerFacade { ...@@ -26,4 +28,6 @@ class COMPONENT_EXPORT(ACCOUNT_MANAGER) AccountManagerFacade {
virtual bool IsInitialized() = 0; virtual bool IsInitialized() = 0;
}; };
#endif // CHROMEOS_COMPONENTS_ACCOUNT_MANAGER_ACCOUNT_MANAGER_FACADE_H_ } // namespace account_manager
#endif // COMPONENTS_ACCOUNT_MANAGER_CORE_ACCOUNT_MANAGER_FACADE_H_
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