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() {
return app_service_;
}
AppRegistryCache& AppServiceProxy::Cache() {
apps::AppRegistryCache& AppServiceProxy::AppRegistryCache() {
return cache_;
}
......
......@@ -25,7 +25,7 @@ namespace 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*
// 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.
class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber {
......@@ -37,7 +37,7 @@ class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber {
~AppServiceProxy() override;
apps::mojom::AppServicePtr& AppService();
AppRegistryCache& Cache();
apps::AppRegistryCache& AppRegistryCache();
void LoadIcon(const std::string& app_id,
apps::mojom::IconCompression icon_compression,
......@@ -67,7 +67,7 @@ class AppServiceProxy : public KeyedService, public apps::mojom::Subscriber {
apps::mojom::AppServicePtr app_service_;
mojo::BindingSet<apps::mojom::Subscriber> bindings_;
AppRegistryCache cache_;
apps::AppRegistryCache cache_;
#if defined(OS_CHROMEOS)
BuiltInChromeOsApps built_in_chrome_os_apps_;
......
......@@ -16,9 +16,9 @@ AppServiceAppModelBuilder::~AppServiceAppModelBuilder() = default;
void AppServiceAppModelBuilder::BuildModel() {
apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile());
if (proxy) {
proxy->Cache().ForEachApp(
proxy->AppRegistryCache().ForEachApp(
[this](const apps::AppUpdate& update) { OnAppUpdate(update); });
Observe(&proxy->Cache());
Observe(&proxy->AppRegistryCache());
} else {
// TODO(crbug.com/826982): do we want apps in incognito mode? See the TODO
// in AppServiceProxyFactory::GetForProfile about whether
......
......@@ -265,7 +265,7 @@ class AppServiceDataSource : public AppSearchProvider::DataSource,
: AppSearchProvider::DataSource(profile, owner) {
apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile);
if (proxy) {
Observe(&proxy->Cache());
Observe(&proxy->AppRegistryCache());
}
}
......@@ -277,8 +277,8 @@ class AppServiceDataSource : public AppSearchProvider::DataSource,
if (!proxy) {
return;
}
proxy->Cache().ForEachApp([this,
apps_vector](const apps::AppUpdate& update) {
proxy->AppRegistryCache().ForEachApp([this, apps_vector](
const apps::AppUpdate& update) {
if (update.ShowInSearch() != apps::mojom::OptionalBool::kTrue) {
return;
}
......
......@@ -27,13 +27,14 @@ AppServiceAppResult::AppServiceAppResult(Profile* profile,
apps::AppServiceProxy* proxy = apps::AppServiceProxy::Get(profile);
if (proxy) {
proxy->Cache().ForOneApp(app_id, [this](const apps::AppUpdate& update) {
app_type_ = update.AppType();
is_platform_app_ =
update.IsPlatformApp() == apps::mojom::OptionalBool::kTrue;
show_in_launcher_ =
update.ShowInLauncher() == apps::mojom::OptionalBool::kTrue;
});
proxy->AppRegistryCache().ForOneApp(
app_id, [this](const apps::AppUpdate& update) {
app_type_ = update.AppType();
is_platform_app_ =
update.IsPlatformApp() == apps::mojom::OptionalBool::kTrue;
show_in_launcher_ =
update.ShowInLauncher() == apps::mojom::OptionalBool::kTrue;
});
constexpr bool allow_placeholder_icon = true;
CallLoadIcon(false, allow_placeholder_icon);
......
......@@ -55,7 +55,7 @@ AppManagementPageHandler::AppManagementPageHandler(
if (!proxy)
return;
Observe(&proxy->Cache());
Observe(&proxy->AppRegistryCache());
}
AppManagementPageHandler::~AppManagementPageHandler() {}
......@@ -71,10 +71,11 @@ void AppManagementPageHandler::OnPinnedChanged(const std::string& app_id,
app_management::mojom::AppPtr app;
proxy->Cache().ForOneApp(app_id, [this, &app](const apps::AppUpdate& update) {
if (update.Readiness() == apps::mojom::Readiness::kReady)
app = CreateUIAppPtr(update);
});
proxy->AppRegistryCache().ForOneApp(
app_id, [this, &app](const apps::AppUpdate& update) {
if (update.Readiness() == apps::mojom::Readiness::kReady)
app = CreateUIAppPtr(update);
});
// If an app with this id is not already installed, do nothing.
if (!app)
......@@ -94,11 +95,12 @@ void AppManagementPageHandler::GetApps(GetAppsCallback callback) {
return;
std::vector<app_management::mojom::AppPtr> apps;
proxy->Cache().ForEachApp([this, &apps](const apps::AppUpdate& update) {
if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue) {
apps.push_back(CreateUIAppPtr(update));
}
});
proxy->AppRegistryCache().ForEachApp(
[this, &apps](const apps::AppUpdate& update) {
if (update.ShowInManagement() == apps::mojom::OptionalBool::kTrue) {
apps.push_back(CreateUIAppPtr(update));
}
});
std::move(callback).Run(std::move(apps));
}
......
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