Commit ba987517 authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Rename AppServiceProxy's Cache to AppRegistryCache

An upcoming commit will introduce an icon cache concept.

BUG=826982

Change-Id: I5d2e7e176dc76dc4f0050abc2584607eb8ae2519
Reviewed-on: https://chromium-review.googlesource.com/c/1491058Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636308}
parent a35e6f25
...@@ -55,7 +55,7 @@ apps::mojom::AppServicePtr& AppServiceProxy::AppService() { ...@@ -55,7 +55,7 @@ apps::mojom::AppServicePtr& AppServiceProxy::AppService() {
return app_service_; return app_service_;
} }
AppRegistryCache& AppServiceProxy::Cache() { apps::AppRegistryCache& AppServiceProxy::AppRegistryCache() {
return cache_; return cache_;
} }
......
...@@ -25,7 +25,7 @@ namespace apps { ...@@ -25,7 +25,7 @@ namespace apps {
// Singleton (per Profile) proxy and cache of an App Service's apps. // Singleton (per Profile) proxy and cache of an App Service's apps.
// //
// Singleton-ness means that //chrome/browser code (e.g UI code) can find *the* // Singleton-ness means that //chrome/browser code (e.g UI code) can find *the*
// proxy for a given Profile, and therefore share the cache. // proxy for a given Profile, and therefore share its caches.
// //
// See chrome/services/app_service/README.md. // See chrome/services/app_service/README.md.
class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber { class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber {
...@@ -37,7 +37,7 @@ class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber { ...@@ -37,7 +37,7 @@ class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber {
~AppServiceProxy() override; ~AppServiceProxy() override;
apps::mojom::AppServicePtr& AppService(); apps::mojom::AppServicePtr& AppService();
AppRegistryCache& Cache(); apps::AppRegistryCache& AppRegistryCache();
void LoadIcon(const std::string& app_id, void LoadIcon(const std::string& app_id,
apps::mojom::IconCompression icon_compression, apps::mojom::IconCompression icon_compression,
...@@ -67,7 +67,7 @@ class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber { ...@@ -67,7 +67,7 @@ class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber {
apps::mojom::AppServicePtr app_service_; apps::mojom::AppServicePtr app_service_;
mojo::BindingSet<apps::mojom::Subscriber> bindings_; mojo::BindingSet<apps::mojom::Subscriber> bindings_;
AppRegistryCache cache_; apps::AppRegistryCache cache_;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
BuiltInChromeOsApps built_in_chrome_os_apps_; BuiltInChromeOsApps built_in_chrome_os_apps_;
......
...@@ -16,9 +16,9 @@ AppServiceAppModelBuilder::~AppServiceAppModelBuilder() = default; ...@@ -16,9 +16,9 @@ AppServiceAppModelBuilder::~AppServiceAppModelBuilder() = default;
void AppServiceAppModelBuilder::BuildModel() { void AppServiceAppModelBuilder::BuildModel() {
apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile()); apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile());
if (proxy) { if (proxy) {
proxy->Cache().ForEachApp( proxy->AppRegistryCache().ForEachApp(
[this](const apps::AppUpdate& update) { OnAppUpdate(update); }); [this](const apps::AppUpdate& update) { OnAppUpdate(update); });
Observe(&proxy->Cache()); Observe(&proxy->AppRegistryCache());
} else { } else {
// TODO(crbug.com/826982): do we want apps in incognito mode? See the TODO // TODO(crbug.com/826982): do we want apps in incognito mode? See the TODO
// in AppServiceProxyFactory::GetForProfile about whether // in AppServiceProxyFactory::GetForProfile about whether
......
...@@ -265,7 +265,7 @@ class AppServiceDataSource : public AppSearchProvider::DataSource, ...@@ -265,7 +265,7 @@ class AppServiceDataSource : public AppSearchProvider::DataSource,
: AppSearchProvider::DataSource(profile, owner) { : AppSearchProvider::DataSource(profile, owner) {
apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile); apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile);
if (proxy) { if (proxy) {
Observe(&proxy->Cache()); Observe(&proxy->AppRegistryCache());
} }
} }
...@@ -277,8 +277,8 @@ class AppServiceDataSource : public AppSearchProvider::DataSource, ...@@ -277,8 +277,8 @@ class AppServiceDataSource : public AppSearchProvider::DataSource,
if (!proxy) { if (!proxy) {
return; return;
} }
proxy->Cache().ForEachApp([this, proxy->AppRegistryCache().ForEachApp([this, apps_vector](
apps_vector](const apps::AppUpdate& update) { const apps::AppUpdate& update) {
if (update.ShowInSearch() != apps::mojom::OptionalBool::kTrue) { if (update.ShowInSearch() != apps::mojom::OptionalBool::kTrue) {
return; return;
} }
......
...@@ -27,7 +27,8 @@ AppServiceAppResult::AppServiceAppResult(Profile* profile, ...@@ -27,7 +27,8 @@ AppServiceAppResult::AppServiceAppResult(Profile* profile,
apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile); apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile);
if (proxy) { if (proxy) {
proxy->Cache().ForOneApp(app_id, [this](const apps::AppUpdate& update) { proxy->AppRegistryCache().ForOneApp(
app_id, [this](const apps::AppUpdate& update) {
app_type_ = update.AppType(); app_type_ = update.AppType();
is_platform_app_ = is_platform_app_ =
update.IsPlatformApp() == apps::mojom::OptionalBool::kTrue; update.IsPlatformApp() == apps::mojom::OptionalBool::kTrue;
......
...@@ -55,7 +55,7 @@ AppManagementPageHandler::AppManagementPageHandler( ...@@ -55,7 +55,7 @@ AppManagementPageHandler::AppManagementPageHandler(
if (!proxy) if (!proxy)
return; return;
Observe(&proxy->Cache()); Observe(&proxy->AppRegistryCache());
} }
AppManagementPageHandler::~AppManagementPageHandler() {} AppManagementPageHandler::~AppManagementPageHandler() {}
...@@ -71,7 +71,8 @@ void AppManagementPageHandler::OnPinnedChanged(const std::string& app_id, ...@@ -71,7 +71,8 @@ void AppManagementPageHandler::OnPinnedChanged(const std::string& app_id,
app_management::mojom::AppPtr app; app_management::mojom::AppPtr app;
proxy->Cache().ForOneApp(app_id, [this, &app](const apps::AppUpdate& update) { proxy->AppRegistryCache().ForOneApp(
app_id, [this, &app](const apps::AppUpdate& update) {
if (update.Readiness() == apps::mojom::Readiness::kReady) if (update.Readiness() == apps::mojom::Readiness::kReady)
app = CreateUIAppPtr(update); app = CreateUIAppPtr(update);
}); });
...@@ -94,7 +95,8 @@ void AppManagementPageHandler::GetApps(GetAppsCallback callback) { ...@@ -94,7 +95,8 @@ void AppManagementPageHandler::GetApps(GetAppsCallback callback) {
return; return;
std::vector<app_management::mojom::AppPtr> apps; std::vector<app_management::mojom::AppPtr> apps;
proxy->Cache().ForEachApp([this, &apps](const apps::AppUpdate& update) { proxy->AppRegistryCache().ForEachApp(
[this, &apps](const apps::AppUpdate& update) {
if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue) { if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue) {
apps.push_back(CreateUIAppPtr(update)); apps.push_back(CreateUIAppPtr(update));
} }
......
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