Move AppRegistryCache::OnApps to the private method.
This CL is used to prepare for CL:4930449. We suggest using
AppServiceProxy::OnApps if possible, because there are some specific
handing for preference, app storage, etc in AppServiceProxy::OnApps.
So we move AppRegistryCache::OnApps to the private method to prevent
calling it from the production code.
For some tests without Profile, we provide OnAppsForTesting for
testing only, e.g. for unit tests.
Modify the test code to use AppServiceProxy::OnApps.
Modify app_registry_cache.cc to keep the consistent sequence as the
definition in app_registry_cache.h.
This CL is pure refactor, and no change on the production code.
BUG=1385932
Change-Id: I739d88e280d1e946f34f902f55e361e56351dd3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4933701
Commit-Queue: Nancy Wang <[email protected]>
Reviewed-by: Xiyuan Xia <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Reviewed-by: Yanzhu Du <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1210638}
diff --git a/chrome/browser/apps/app_service/app_icon/browser_shortcut_icon_unittest.cc b/chrome/browser/apps/app_service/app_icon/browser_shortcut_icon_unittest.cc
index 5a62a9a..a8c03f8e 100644
--- a/chrome/browser/apps/app_service/app_icon/browser_shortcut_icon_unittest.cc
+++ b/chrome/browser/apps/app_service/app_icon/browser_shortcut_icon_unittest.cc
@@ -90,9 +90,8 @@
AppType::kChromeApp, app_constants::kChromeAppId,
apps::Readiness::kReady, "Some App Name", apps::InstallReason::kUser,
apps::InstallSource::kSystem));
- app_service_proxy()->AppRegistryCache().OnApps(
- std::move(app_deltas), AppType::kChromeApp,
- /* should_notify_initialized */ true);
+ app_service_proxy()->OnApps(std::move(app_deltas), AppType::kChromeApp,
+ /* should_notify_initialized */ true);
}
AppServiceProxy* app_service_proxy() { return proxy_; }
diff --git a/chrome/browser/apps/app_service/app_service_proxy_lacros.cc b/chrome/browser/apps/app_service/app_service_proxy_lacros.cc
index d1127f9..c2738b0 100644
--- a/chrome/browser/apps/app_service/app_service_proxy_lacros.cc
+++ b/chrome/browser/apps/app_service/app_service_proxy_lacros.cc
@@ -112,6 +112,13 @@
return metrics_service_.get();
}
+void AppServiceProxyLacros::OnApps(std::vector<AppPtr> deltas,
+ AppType app_type,
+ bool should_notify_initialized) {
+ app_registry_cache_.OnApps(std::move(deltas), app_type,
+ should_notify_initialized);
+}
+
std::unique_ptr<IconLoader::Releaser> AppServiceProxyLacros::LoadIcon(
AppType app_type,
const std::string& app_id,
@@ -560,13 +567,6 @@
}
}
-void AppServiceProxyLacros::OnApps(std::vector<AppPtr> deltas,
- AppType app_type,
- bool should_notify_initialized) {
- app_registry_cache_.OnApps(std::move(deltas), app_type,
- should_notify_initialized);
-}
-
void AppServiceProxyLacros::OnPreferredAppsChanged(
PreferredAppChangesPtr changes) {
preferred_apps_list_.ApplyBulkUpdate(std::move(changes));
diff --git a/chrome/browser/apps/app_service/app_service_proxy_lacros.h b/chrome/browser/apps/app_service/app_service_proxy_lacros.h
index 21aebe48..2492cf4 100644
--- a/chrome/browser/apps/app_service/app_service_proxy_lacros.h
+++ b/chrome/browser/apps/app_service/app_service_proxy_lacros.h
@@ -103,6 +103,11 @@
apps::WebsiteMetricsServiceLacros* WebsiteMetricsService();
+ // crosapi::mojom::AppServiceSubscriber overrides.
+ void OnApps(std::vector<AppPtr> deltas,
+ AppType app_type,
+ bool should_notify_initialized) override;
+
// Convenience method that calls app_icon_loader()->LoadIcon to load app icons
// with `app_id`. `callback` may be dispatched synchronously if it's possible
// to quickly return a result.
@@ -299,9 +304,6 @@
void Shutdown() override;
// crosapi::mojom::AppServiceSubscriber overrides.
- void OnApps(std::vector<AppPtr> deltas,
- AppType app_type,
- bool should_notify_initialized) override;
void OnPreferredAppsChanged(PreferredAppChangesPtr changes) override;
void InitializePreferredApps(PreferredApps preferred_apps) override;
diff --git a/chrome/browser/apps/app_service/app_service_test.cc b/chrome/browser/apps/app_service/app_service_test.cc
index 1f73bd5..cc58663 100644
--- a/chrome/browser/apps/app_service/app_service_test.cc
+++ b/chrome/browser/apps/app_service/app_service_test.cc
@@ -37,9 +37,8 @@
app->readiness = Readiness::kUninstalledByUser;
apps.push_back(std::move(app));
});
- app_service_proxy->AppRegistryCache().OnApps(
- std::move(apps), AppType::kUnknown,
- false /* should_notify_initialized */);
+ app_service_proxy->OnApps(std::move(apps), AppType::kUnknown,
+ false /* should_notify_initialized */);
}
std::string AppServiceTest::GetAppName(const std::string& app_id) const {
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.cc
index 0ceb4e8..35a73546 100644
--- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.cc
+++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.cc
@@ -59,7 +59,7 @@
return app;
}
-void AddApp(AppRegistryCache& cache,
+void AddApp(AppServiceProxy* proxy,
const std::string& app_id,
AppType app_type,
const std::string& publisher_id,
@@ -69,11 +69,12 @@
bool should_notify_initialized,
bool is_platform_app,
WindowMode window_mode) {
+ CHECK(proxy);
std::vector<AppPtr> deltas;
deltas.push_back(MakeApp(app_id, app_type, publisher_id, readiness,
install_reason, install_source, is_platform_app,
window_mode));
- cache.OnApps(std::move(deltas), app_type, should_notify_initialized);
+ proxy->OnApps(std::move(deltas), app_type, should_notify_initialized);
}
AppPlatformMetricsServiceTestBase::AppPlatformMetricsServiceTestBase() =
@@ -102,7 +103,7 @@
// Install a BuiltIn app before app_platform_metrics_service_ started to
// verify the install AppKM.
- AddApp(AppServiceProxyFactory::GetForProfile(profile())->AppRegistryCache(),
+ AddApp(AppServiceProxyFactory::GetForProfile(profile()),
/*app_id=*/"bu", AppType::kBuiltIn, "", Readiness::kReady,
InstallReason::kSystem, InstallSource::kSystem,
true /* should_notify_initialized */);
@@ -126,8 +127,7 @@
bool is_platform_app,
WindowMode window_mode) {
auto* proxy = AppServiceProxyFactory::GetForProfile(profile());
- AppRegistryCache& cache = proxy->AppRegistryCache();
- AddApp(cache, app_id, app_type, publisher_id, readiness, InstallReason::kUser,
+ AddApp(proxy, app_id, app_type, publisher_id, readiness, InstallReason::kUser,
install_source, false /* should_notify_initialized */, is_platform_app,
window_mode);
}
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.h b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.h
index 67b38ffc..df3b3dc 100644
--- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.h
+++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.h
@@ -13,7 +13,6 @@
#include "chrome/browser/apps/app_service/metrics/app_platform_metrics_service.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chrome/test/base/testing_profile.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/instance.h"
#include "components/sync/test/test_sync_service.h"
@@ -39,7 +38,7 @@
// Helper method that adds a new app using the provided app metadata with the
// `AppRegistryCache`.
-void AddApp(AppRegistryCache& cache,
+void AddApp(AppServiceProxy* proxy,
const std::string& app_id,
AppType app_type,
const std::string& publisher_id,
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
index f9cb879..2e37f18 100644
--- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
+++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
@@ -56,7 +56,6 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/instance.h"
#include "components/services/app_service/public/cpp/instance_registry.h"
@@ -258,19 +257,19 @@
void InstallApps() {
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile());
- apps::AppRegistryCache& cache = proxy->AppRegistryCache();
+ CHECK(proxy);
- AddApp(cache, kAndroidAppId, AppType::kArc, kAndroidAppPublisherId,
+ AddApp(proxy, kAndroidAppId, AppType::kArc, kAndroidAppPublisherId,
Readiness::kReady, InstallReason::kUser, InstallSource::kPlayStore,
true /* should_notify_initialized */);
- AddApp(cache, /*app_id=*/borealis::kClientAppId, AppType::kBorealis, "",
+ AddApp(proxy, /*app_id=*/borealis::kClientAppId, AppType::kBorealis, "",
Readiness::kReady, InstallReason::kUser, InstallSource::kUnknown,
true /* should_notify_initialized */);
borealis::CreateFakeApp(profile(), "borealistest", "steam://rungameid/123");
std::string borealis_app(borealis::FakeAppId("borealistest"));
- AddApp(cache, /*app_id=*/borealis_app.c_str(), AppType::kBorealis, "",
+ AddApp(proxy, /*app_id=*/borealis_app.c_str(), AppType::kBorealis, "",
Readiness::kReady, InstallReason::kUser, InstallSource::kUnknown,
true /* should_notify_initialized */);
@@ -278,35 +277,35 @@
crostini::CrostiniTestHelper::BasicAppList("test");
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile())
->UpdateApplicationList(app_list);
- AddApp(cache, /*app_id=*/
+ AddApp(proxy, /*app_id=*/
crostini::CrostiniTestHelper::GenerateAppId("test"),
AppType::kCrostini, "", Readiness::kReady, InstallReason::kUser,
InstallSource::kUnknown, true /* should_notify_initialized */);
- AddApp(cache, /*app_id=*/"w", AppType::kWeb, "https://foo.com",
+ AddApp(proxy, /*app_id=*/"w", AppType::kWeb, "https://foo.com",
Readiness::kReady, InstallReason::kSync, InstallSource::kSync,
false /* should_notify_initialized */);
- AddApp(cache, /*app_id=*/"w2", AppType::kWeb, "https://foo2.com",
+ AddApp(proxy, /*app_id=*/"w2", AppType::kWeb, "https://foo2.com",
Readiness::kReady, InstallReason::kSync, InstallSource::kSync,
true /* should_notify_initialized */);
- AddApp(cache, /*app_id=*/"s", AppType::kSystemWeb, "https://os-settings",
+ AddApp(proxy, /*app_id=*/"s", AppType::kSystemWeb, "https://os-settings",
Readiness::kReady, InstallReason::kSystem, InstallSource::kSystem,
true /* should_notify_initialized */);
- AddApp(cache, /*app_id=*/app_constants::kLacrosAppId,
+ AddApp(proxy, /*app_id=*/app_constants::kLacrosAppId,
AppType::kStandaloneBrowser, "Lacros", Readiness::kReady,
InstallReason::kSystem, InstallSource::kSystem,
true /* should_notify_initialized */);
- AddApp(cache,
+ AddApp(proxy,
/*app_id=*/kChromeAppId, AppType::kStandaloneBrowserChromeApp,
"Vine", Readiness::kReady, InstallReason::kUser,
InstallSource::kChromeWebStore, true /* should_notify_initialized */,
true /*is_platform_app*/);
- AddApp(cache,
+ AddApp(proxy,
/*app_id=*/kExtensionId, AppType::kStandaloneBrowserExtension,
"PDF Viewer", Readiness::kReady, InstallReason::kUser,
InstallSource::kChromeWebStore,
@@ -328,8 +327,8 @@
deltas.push_back(MakeApp(
/*app_id=*/"subapp", AppType::kWeb, "", Readiness::kReady,
InstallReason::kSubApp, InstallSource::kUnknown));
- cache.OnApps(std::move(deltas), AppType::kUnknown,
- false /* should_notify_initialized */);
+ proxy->OnApps(std::move(deltas), AppType::kUnknown,
+ false /* should_notify_initialized */);
}
void VerifyMetrics() {
@@ -3064,13 +3063,12 @@
base::test::ScopedRunLoopTimeout default_timeout(FROM_HERE, base::Seconds(3));
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile());
- apps::AppRegistryCache& cache = proxy->AppRegistryCache();
proxy->SetAppPlatformMetricsServiceForTesting(GetAppPlatformMetricsService());
const std::string expected_app_id =
base::StrCat({"app://", kAndroidAppPublisherId});
// Install an ARC app to test.
- AddApp(cache, kAndroidAppId, AppType::kArc, kAndroidAppPublisherId,
+ AddApp(proxy, kAndroidAppId, AppType::kArc, kAndroidAppPublisherId,
Readiness::kReady, InstallReason::kUser, InstallSource::kPlayStore,
true /* should_notify_initialized */);
@@ -3175,13 +3173,12 @@
base::test::ScopedRunLoopTimeout default_timeout(FROM_HERE, base::Seconds(3));
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile());
- apps::AppRegistryCache& cache = proxy->AppRegistryCache();
proxy->SetAppPlatformMetricsServiceForTesting(GetAppPlatformMetricsService());
const std::string expected_app_id =
base::StrCat({"app://", kAndroidAppPublisherId});
// Install an ARC app to test.
- AddApp(cache, kAndroidAppId, AppType::kArc, kAndroidAppPublisherId,
+ AddApp(proxy, kAndroidAppId, AppType::kArc, kAndroidAppPublisherId,
Readiness::kReady, InstallReason::kUser, InstallSource::kPlayStore,
true /* should_notify_initialized */);
diff --git a/chrome/browser/apps/app_service/promise_apps/promise_app_service_unittest.cc b/chrome/browser/apps/app_service/promise_apps/promise_app_service_unittest.cc
index 0d30437..8dbcb04a 100644
--- a/chrome/browser/apps/app_service/promise_apps/promise_app_service_unittest.cc
+++ b/chrome/browser/apps/app_service/promise_apps/promise_app_service_unittest.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/testing_profile.h"
#include "chromeos/ash/components/system/fake_statistics_provider.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/icon_types.h"
#include "content/public/test/browser_task_environment.h"
@@ -52,9 +51,8 @@
test_shared_loader_factory_ =
base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
url_loader_factory_.get());
- app_cache_ = &AppServiceProxyFactory::GetForProfile(profile_.get())
- ->AppRegistryCache();
- service_ = std::make_unique<PromiseAppService>(profile_.get(), *app_cache_);
+ service_ = std::make_unique<PromiseAppService>(profile_.get(),
+ proxy()->AppRegistryCache());
service_->SetSkipApiKeyCheckForTesting(true);
}
@@ -66,7 +64,9 @@
return service_->PromiseAppRegistryCache();
}
- AppRegistryCache* app_cache() { return app_cache_; }
+ AppServiceProxy* proxy() {
+ return AppServiceProxyFactory::GetForProfile(profile_.get());
+ }
PromiseAppIconCache* icon_cache() { return service_->PromiseAppIconCache(); }
@@ -133,7 +133,6 @@
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
data_decoder::test::InProcessDataDecoder in_process_data_decoder_;
- raw_ptr<AppRegistryCache> app_cache_;
// Tracks how many times we should expect OnPromiseAppUpdate to be called
// before proceeding with a unit test.
@@ -280,8 +279,8 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache()->OnApps(std::move(apps), app_type,
- /*should_notify_initialized=*/false);
+ proxy()->OnApps(std::move(apps), app_type,
+ /*should_notify_initialized=*/false);
// Confirm that the promise app is now absent from the Promise App Registry
// and Promise App Icon Cache.
@@ -301,8 +300,8 @@
app->readiness = apps::Readiness::kReady;
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache()->OnApps(std::move(apps), app_type,
- /*should_notify_initialized=*/false);
+ proxy()->OnApps(std::move(apps), app_type,
+ /*should_notify_initialized=*/false);
// Attempt to register test promise app with a matching package ID.
PromiseAppPtr promise_app = std::make_unique<PromiseApp>(package_id);
@@ -324,8 +323,8 @@
app->readiness = apps::Readiness::kUninstalledByUser;
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache()->OnApps(std::move(apps), app_type,
- /*should_notify_initialized=*/false);
+ proxy()->OnApps(std::move(apps), app_type,
+ /*should_notify_initialized=*/false);
// Register test promise app with a matching package ID.
PromiseAppPtr promise_app = std::make_unique<PromiseApp>(package_id);
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc b/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc
index f566fad..c3e5d3b 100644
--- a/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc
+++ b/chrome/browser/apps/app_service/publishers/arc_apps_unittest.cc
@@ -841,7 +841,6 @@
app_service_proxy()->ReinitializeForTesting(profile());
apps::PromiseAppRegistryCache* promise_cache =
app_service_proxy()->PromiseAppRegistryCache();
- apps::AppRegistryCache& app_cache = app_service_proxy()->AppRegistryCache();
std::string package_name = "com.example.this";
apps::PackageId package_id =
@@ -868,8 +867,8 @@
app->readiness = apps::Readiness::kReady;
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache.OnApps(std::move(apps), apps::AppType::kWeb,
- /*should_notify_initialized=*/false);
+ app_service_proxy()->OnApps(std::move(apps), apps::AppType::kWeb,
+ /*should_notify_initialized=*/false);
// Confirm that the promise app is now absent from the Promise App Registry.
EXPECT_FALSE(promise_cache->HasPromiseApp(package_id));
diff --git a/chrome/browser/apps/app_service/publishers/shortcut_publisher_unittest.cc b/chrome/browser/apps/app_service/publishers/shortcut_publisher_unittest.cc
index b61c353..9253fdb 100644
--- a/chrome/browser/apps/app_service/publishers/shortcut_publisher_unittest.cc
+++ b/chrome/browser/apps/app_service/publishers/shortcut_publisher_unittest.cc
@@ -111,8 +111,8 @@
app_deltas.push_back(apps::AppPublisher::MakeApp(
type, app_id, apps::Readiness::kReady, "Some App Name",
apps::InstallReason::kUser, apps::InstallSource::kSystem));
- proxy()->AppRegistryCache().OnApps(std::move(app_deltas), type,
- /* should_notify_initialized */ true);
+ proxy()->OnApps(std::move(app_deltas), type,
+ /* should_notify_initialized */ true);
}
private:
diff --git a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc
index a25f0dd..a326f24b 100644
--- a/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc
+++ b/chrome/browser/ash/accessibility/spoken_feedback_browsertest.cc
@@ -789,9 +789,8 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
apps::AppServiceProxyFactory::GetForProfile(GetProfile())
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kBuiltIn,
- false /* should_notify_initialized */);
+ ->OnApps(std::move(apps), apps::AppType::kBuiltIn,
+ false /* should_notify_initialized */);
// Create and add a test app to the shelf model.
ShelfItem item;
@@ -875,9 +874,8 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
apps::AppServiceProxyFactory::GetForProfile(GetProfile())
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kBuiltIn,
- false /* should_notify_initialized */);
+ ->OnApps(std::move(apps), apps::AppType::kBuiltIn,
+ false /* should_notify_initialized */);
// Create and add a test app to the shelf model.
ShelfItem item;
diff --git a/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc b/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc
index 780ad13..99182e2f 100644
--- a/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc
+++ b/chrome/browser/ash/app_list/app_list_client_impl_browsertest.cc
@@ -443,14 +443,12 @@
extensions::PlatformAppBrowserTest::TearDownOnMainThread();
}
- apps::PromiseAppRegistryCache* cache() {
- return apps::AppServiceProxyFactory::GetForProfile(profile())
- ->PromiseAppRegistryCache();
+ apps::AppServiceProxy* app_service_proxy() {
+ return apps::AppServiceProxyFactory::GetForProfile(profile());
}
- apps::AppRegistryCache* app_cache() {
- return &apps::AppServiceProxyFactory::GetForProfile(profile())
- ->AppRegistryCache();
+ apps::PromiseAppRegistryCache* cache() {
+ return app_service_proxy()->PromiseAppRegistryCache();
}
// AppListModelUpdaterObserver:
@@ -518,8 +516,8 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache()->OnApps(std::move(apps), apps::AppType::kArc,
- /*should_notify_initialized=*/false);
+ app_service_proxy()->OnApps(std::move(apps), apps::AppType::kArc,
+ /*should_notify_initialized=*/false);
EXPECT_EQ(1, GetAndResetUpdateCount());
EXPECT_FALSE(model_updater->FindItem(kTestPackageId.ToString()));
diff --git a/chrome/browser/ash/app_list/app_list_syncable_service.cc b/chrome/browser/ash/app_list/app_list_syncable_service.cc
index 1b432bd..e250618b 100644
--- a/chrome/browser/ash/app_list/app_list_syncable_service.cc
+++ b/chrome/browser/ash/app_list/app_list_syncable_service.cc
@@ -145,10 +145,9 @@
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(delta));
- apps::AppServiceProxyFactory::GetForProfile(profile)
- ->AppRegistryCache()
- .OnApps(std::move(deltas), apps::AppType::kChromeApp,
- false /* should_notify_initialized */);
+ apps::AppServiceProxyFactory::GetForProfile(profile)->OnApps(
+ std::move(deltas), apps::AppType::kChromeApp,
+ false /* should_notify_initialized */);
}
bool IsUnRemovableDefaultApp(const std::string& id) {
diff --git a/chrome/browser/ash/app_list/app_service/app_service_app_item_browsertest.cc b/chrome/browser/ash/app_list/app_service/app_service_app_item_browsertest.cc
index bfbcefe..1d9b741 100644
--- a/chrome/browser/ash/app_list/app_service/app_service_app_item_browsertest.cc
+++ b/chrome/browser/ash/app_list/app_service/app_service_app_item_browsertest.cc
@@ -54,10 +54,9 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- apps::AppServiceProxyFactory::GetForProfile(profile)
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kChromeApp,
- false /* should_notify_initialized */);
+ apps::AppServiceProxyFactory::GetForProfile(profile)->OnApps(
+ std::move(apps), apps::AppType::kChromeApp,
+ false /* should_notify_initialized */);
}
void UpdateAppNameInRegistryCache(Profile* profile,
@@ -69,10 +68,9 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- apps::AppServiceProxyFactory::GetForProfile(profile)
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kChromeApp,
- false /* should_notify_initialized */);
+ apps::AppServiceProxyFactory::GetForProfile(profile)->OnApps(
+ std::move(apps), apps::AppType::kChromeApp,
+ false /* should_notify_initialized */);
}
ash::AppListItem* GetAppListItem(const std::string& id) {
diff --git a/chrome/browser/ash/app_list/app_service/app_service_promise_app_item_browsertest.cc b/chrome/browser/ash/app_list/app_service/app_service_promise_app_item_browsertest.cc
index bfdda08a..265c7da 100644
--- a/chrome/browser/ash/app_list/app_service/app_service_promise_app_item_browsertest.cc
+++ b/chrome/browser/ash/app_list/app_service/app_service_promise_app_item_browsertest.cc
@@ -60,8 +60,7 @@
AppListClientImpl* client = AppListClientImpl::GetInstance();
ASSERT_TRUE(client);
client->UpdateProfile();
- cache_ = apps::AppServiceProxyFactory::GetForProfile(profile())
- ->PromiseAppRegistryCache();
+ cache_ = app_service_proxy()->PromiseAppRegistryCache();
}
ChromeAppListItem* GetChromeAppListItem(const PackageId& package_id) {
@@ -74,9 +73,8 @@
apps::PromiseAppRegistryCache* cache() { return cache_; }
- apps::AppRegistryCache& app_cache() {
- return apps::AppServiceProxyFactory::GetForProfile(profile())
- ->AppRegistryCache();
+ apps::AppServiceProxy* app_service_proxy() {
+ return apps::AppServiceProxyFactory::GetForProfile(profile());
}
private:
@@ -204,8 +202,8 @@
app->readiness = apps::Readiness::kReady;
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache().OnApps(std::move(apps), app_type,
- /*should_notify_initialized=*/false);
+ app_service_proxy()->OnApps(std::move(apps), app_type,
+ /*should_notify_initialized=*/false);
// Promise app item should no longer exist in the model.
item = GetAppListItem(package_id.ToString());
diff --git a/chrome/browser/ash/app_list/search/app_search_provider_unittest.cc b/chrome/browser/ash/app_list/search/app_search_provider_unittest.cc
index e566df6..7de4b9e 100644
--- a/chrome/browser/ash/app_list/search/app_search_provider_unittest.cc
+++ b/chrome/browser/ash/app_list/search/app_search_provider_unittest.cc
@@ -87,8 +87,8 @@
apps::AppPtr app = std::make_unique<apps::App>(app_type, app_id);
app->icon_key = std::move(*icon_key);
apps.push_back(std::move(app));
- proxy.AppRegistryCache().OnApps(std::move(apps), apps::AppType::kUnknown,
- false /* should_notify_initialized */);
+ proxy.OnApps(std::move(apps), apps::AppType::kUnknown,
+ false /* should_notify_initialized */);
}
} // namespace
diff --git a/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc b/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc
index e3d5ff0..aa2fdca 100644
--- a/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc
+++ b/chrome/browser/ash/app_restore/arc_ghost_window_view_unittest.cc
@@ -20,7 +20,6 @@
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "chrome/test/views/chrome_test_views_delegate.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/icon_types.h"
#include "components/strings/grit/components_strings.h"
@@ -84,11 +83,10 @@
void InstallApp(const std::string& app_id) {
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile_);
std::vector<apps::AppPtr> deltas;
- apps::AppRegistryCache& cache = proxy->AppRegistryCache();
deltas.push_back(MakeApp(app_id.c_str(), apps::AppType::kArc,
apps::InstallReason::kUser));
- cache.OnApps(std::move(deltas), apps::AppType::kUnknown,
- false /* should_notify_initialized */);
+ proxy->OnApps(std::move(deltas), apps::AppType::kUnknown,
+ false /* should_notify_initialized */);
}
void CreateView(arc::GhostWindowType type, uint32_t theme_color) {
diff --git a/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc b/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc
index 6ab3c78a..a7b62b0d 100644
--- a/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc
+++ b/chrome/browser/ash/app_restore/full_restore_app_launch_handler_browsertest.cc
@@ -2335,8 +2335,8 @@
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile());
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(app));
- proxy->AppRegistryCache().OnApps(std::move(deltas), apps::AppType::kArc,
- false /* should_notify_initialized */);
+ proxy->OnApps(std::move(deltas), apps::AppType::kArc,
+ false /* should_notify_initialized */);
}
void RemoveApp(const std::string& app_id) {
@@ -2346,8 +2346,8 @@
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile());
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(app));
- proxy->AppRegistryCache().OnApps(std::move(deltas), apps::AppType::kArc,
- false /* should_notify_initialized */);
+ proxy->OnApps(std::move(deltas), apps::AppType::kArc,
+ false /* should_notify_initialized */);
}
bool HasRestoreData() {
@@ -2841,14 +2841,13 @@
}
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile());
- apps::AppRegistryCache& cache = proxy->AppRegistryCache();
apps::AppPtr app = std::make_unique<apps::App>(
app_type, *GetManager().GetAppIdForSystemApp(SystemWebAppType::HELP));
app->readiness = readiness;
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(app));
- cache.OnApps(std::move(deltas), app_type,
- false /* should_notify_initialized */);
+ proxy->OnApps(std::move(deltas), app_type,
+ false /* should_notify_initialized */);
}
void SetShouldRestore(FullRestoreAppLaunchHandler* app_launch_handler) {
diff --git a/chrome/browser/ash/child_accounts/family_user_app_metrics_unittest.cc b/chrome/browser/ash/child_accounts/family_user_app_metrics_unittest.cc
index 76b26bd..e48e847 100644
--- a/chrome/browser/ash/child_accounts/family_user_app_metrics_unittest.cc
+++ b/chrome/browser/ash/child_accounts/family_user_app_metrics_unittest.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.h"
#include "chrome/browser/supervised_user/supervised_user_test_util.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/instance.h"
#include "components/services/app_service/public/cpp/instance_registry.h"
@@ -142,9 +141,8 @@
void InstallApps() {
std::vector<apps::AppPtr> deltas;
- apps::AppRegistryCache& cache =
- apps::AppServiceProxyFactory::GetForProfile(profile())
- ->AppRegistryCache();
+ apps::AppServiceProxy* proxy =
+ apps::AppServiceProxyFactory::GetForProfile(profile());
deltas.push_back(MakeApp(/*app_id=*/"u", /*app_name=*/"unknown",
/*last_launch_time=*/base::Time::Now(),
apps::AppType::kUnknown));
@@ -190,12 +188,10 @@
deltas.push_back(MakeApp(/*app_id=*/"s", /*app_name=*/"systemweb",
/*last_launch_time=*/base::Time::Now(),
apps::AppType::kSystemWeb));
- cache.OnApps(std::move(deltas), apps::AppType::kUnknown,
- false /* should_notify_initialized */);
+ proxy->OnApps(std::move(deltas), apps::AppType::kUnknown,
+ false /* should_notify_initialized */);
- apps::InstanceRegistry& instance_registry =
- apps::AppServiceProxyFactory::GetForProfile(profile())
- ->InstanceRegistry();
+ apps::InstanceRegistry& instance_registry = proxy->InstanceRegistry();
window_ = std::make_unique<aura::Window>(nullptr);
window_->Init(ui::LAYER_NOT_DRAWN);
instance_registry.CreateOrUpdateInstance(
diff --git a/chrome/browser/ash/file_manager/file_manager_test_util.cc b/chrome/browser/ash/file_manager/file_manager_test_util.cc
index 1d656cf..637b996 100644
--- a/chrome/browser/ash/file_manager/file_manager_test_util.cc
+++ b/chrome/browser/ash/file_manager/file_manager_test_util.cc
@@ -236,8 +236,8 @@
app->readiness = apps::Readiness::kReady;
app->intent_filters = std::move(intent_filters);
apps.push_back(std::move(app));
- app_service_proxy->AppRegistryCache().OnApps(
- std::move(apps), app_type, false /* should_notify_initialized */);
+ app_service_proxy->OnApps(std::move(apps), app_type,
+ false /* should_notify_initialized */);
}
void AddFakeWebApp(const std::string& app_id,
diff --git a/chrome/browser/ash/file_manager/file_tasks_unittest.cc b/chrome/browser/ash/file_manager/file_tasks_unittest.cc
index 426e0f3..cce09a9 100644
--- a/chrome/browser/ash/file_manager/file_tasks_unittest.cc
+++ b/chrome/browser/ash/file_manager/file_tasks_unittest.cc
@@ -235,8 +235,8 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_service_proxy()->AppRegistryCache().OnApps(
- std::move(apps), app_type, false /* should_notify_initialized */);
+ app_service_proxy()->OnApps(std::move(apps), app_type,
+ false /* should_notify_initialized */);
}
TestingProfile* profile() { return profile_.get(); }
diff --git a/chrome/browser/ash/policy/dlp/dlp_files_controller_ash_unittest.cc b/chrome/browser/ash/policy/dlp/dlp_files_controller_ash_unittest.cc
index d487944..45f010d6 100644
--- a/chrome/browser/ash/policy/dlp/dlp_files_controller_ash_unittest.cc
+++ b/chrome/browser/ash/policy/dlp/dlp_files_controller_ash_unittest.cc
@@ -1952,8 +1952,8 @@
void UpdateAppRegistryCache(std::vector<apps::AppPtr> fake_apps,
apps::AppType app_type) {
- app_service_proxy_->AppRegistryCache().OnApps(
- std::move(fake_apps), app_type, /*should_notify_initialized=*/false);
+ app_service_proxy_->OnApps(std::move(fake_apps), app_type,
+ /*should_notify_initialized=*/false);
}
raw_ptr<apps::AppServiceProxy, DanglingUntriaged | ExperimentalAsh>
diff --git a/chrome/browser/ash/policy/status_collector/app_info_generator_unittest.cc b/chrome/browser/ash/policy/status_collector/app_info_generator_unittest.cc
index a283050e..12e20bb1 100644
--- a/chrome/browser/ash/policy/status_collector/app_info_generator_unittest.cc
+++ b/chrome/browser/ash/policy/status_collector/app_info_generator_unittest.cc
@@ -142,8 +142,8 @@
apps::AppType app_type = app->app_type;
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(app));
- GetCache().OnApps(std::move(deltas), app_type,
- /*should_notify_initialized=*/false);
+ AppServiceProxy()->OnApps(std::move(deltas), app_type,
+ /*should_notify_initialized=*/false);
}
void PushApp(const std::string& app_id,
@@ -204,9 +204,8 @@
app_registrar_ = &provider->GetRegistrarMutable();
}
- apps::AppRegistryCache& GetCache() {
- return apps::AppServiceProxyFactory::GetForProfile(profile_.get())
- ->AppRegistryCache();
+ apps::AppServiceProxy* AppServiceProxy() {
+ return apps::AppServiceProxyFactory::GetForProfile(profile_.get());
}
apps::InstanceRegistry& GetInstanceRegistry() {
diff --git a/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
index b1e2ec2..9ddc978 100644
--- a/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
+++ b/chrome/browser/ash/policy/status_collector/device_status_collector_browsertest.cc
@@ -104,7 +104,6 @@
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/testing_pref_service.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/session_manager/core/session_manager.h"
#include "components/upload_list/upload_list.h"
@@ -3803,8 +3802,8 @@
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app1));
apps.push_back(std::move(app2));
- app_proxy->AppRegistryCache().OnApps(std::move(apps), apps::AppType::kUnknown,
- /*should_notify_initialized=*/false);
+ app_proxy->OnApps(std::move(apps), apps::AppType::kUnknown,
+ /*should_notify_initialized=*/false);
// Start app instance
base::Time start_time;
diff --git a/chrome/browser/ash/system_logs/app_service_log_source_unittest.cc b/chrome/browser/ash/system_logs/app_service_log_source_unittest.cc
index 4f93ffd..a5e6a46 100644
--- a/chrome/browser/ash/system_logs/app_service_log_source_unittest.cc
+++ b/chrome/browser/ash/system_logs/app_service_log_source_unittest.cc
@@ -48,14 +48,13 @@
const std::string& publisher_id,
apps::AppType app_type) {
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile_);
- apps::AppRegistryCache& cache = proxy->AppRegistryCache();
apps::AppPtr app = apps::AppPublisher::MakeApp(
app_type, app_id, apps::Readiness::kReady, "app-name",
apps::InstallReason::kUser, apps::InstallSource::kPlayStore);
app->publisher_id = publisher_id;
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(app));
- cache.OnApps(std::move(deltas), app_type, true);
+ proxy->OnApps(std::move(deltas), app_type, true);
}
void RunApp(const std::string& app_id) {
diff --git a/chrome/browser/ash/system_web_apps/apps/media_app/media_app_integration_browsertest.cc b/chrome/browser/ash/system_web_apps/apps/media_app/media_app_integration_browsertest.cc
index 56d1463..6e1a14c 100644
--- a/chrome/browser/ash/system_web_apps/apps/media_app/media_app_integration_browsertest.cc
+++ b/chrome/browser/ash/system_web_apps/apps/media_app/media_app_integration_browsertest.cc
@@ -271,9 +271,8 @@
auto* proxy = apps::AppServiceProxyFactory::GetForProfile(profile);
std::vector<apps::AppPtr> registry_deltas;
registry_deltas.push_back(MakePhotosApp(photos_version));
- proxy->AppRegistryCache().OnApps(std::move(registry_deltas),
- apps::AppType::kUnknown,
- /*should_notify_initialized=*/false);
+ proxy->OnApps(std::move(registry_deltas), apps::AppType::kUnknown,
+ /*should_notify_initialized=*/false);
}
static bool GetFlagInApp(content::WebContents* web_ui, const char* flag) {
diff --git a/chrome/browser/ash/video_conference/video_conference_app_service_client_browsertest.cc b/chrome/browser/ash/video_conference/video_conference_app_service_client_browsertest.cc
index cc14878..4c49ae9 100644
--- a/chrome/browser/ash/video_conference/video_conference_app_service_client_browsertest.cc
+++ b/chrome/browser/ash/video_conference/video_conference_app_service_client_browsertest.cc
@@ -36,7 +36,6 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/crosapi/mojom/video_conference.mojom.h"
#include "components/services/app_service/public/cpp/app_capability_access_cache_wrapper.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/capability_access_update.h"
#include "components/services/app_service/public/cpp/instance_registry.h"
@@ -164,10 +163,8 @@
client_->test_ukm_recorder_ = test_ukm_recorder_.get();
Profile* profile = ProfileManager::GetActiveUserProfile();
- instance_registry_ = &apps::AppServiceProxyFactory::GetForProfile(profile)
- ->InstanceRegistry();
- app_registry_cache_ = &apps::AppServiceProxyFactory::GetForProfile(profile)
- ->AppRegistryCache();
+ app_service_proxy_ = apps::AppServiceProxyFactory::GetForProfile(profile);
+ instance_registry_ = &app_service_proxy_->InstanceRegistry();
capability_cache_ =
apps::AppCapabilityAccessCacheWrapper::Get()
.GetAppCapabilityAccessCache(user_manager::UserManager::Get()
@@ -182,8 +179,8 @@
std::vector<apps::AppPtr> deltas;
deltas.push_back(MakeApp(app_id, /*has_camera_permission=*/false,
/*has_microphone_permission=*/false, app_type));
- app_registry_cache_->OnApps(std::move(deltas), apps::AppType::kUnknown,
- /*should_notify_initialized=*/false);
+ app_service_proxy_->OnApps(std::move(deltas), apps::AppType::kUnknown,
+ /*should_notify_initialized=*/false);
}
// Update the permission of current `app_id`.
@@ -193,8 +190,8 @@
std::vector<apps::AppPtr> deltas;
deltas.push_back(MakeApp(app_id, has_camera_permission,
has_microphone_permission, GetAppType(app_id)));
- app_registry_cache_->OnApps(std::move(deltas), apps::AppType::kUnknown,
- /*should_notify_initialized=*/false);
+ app_service_proxy_->OnApps(std::move(deltas), apps::AppType::kUnknown,
+ /*should_notify_initialized=*/false);
}
// Set the camera/michrophone accessing info for app with `app_id`.
@@ -250,10 +247,10 @@
}
protected:
+ raw_ptr<apps::AppServiceProxy, DanglingUntriaged | ExperimentalAsh>
+ app_service_proxy_ = nullptr;
raw_ptr<apps::InstanceRegistry, DanglingUntriaged | ExperimentalAsh>
instance_registry_ = nullptr;
- raw_ptr<apps::AppRegistryCache, DanglingUntriaged | ExperimentalAsh>
- app_registry_cache_ = nullptr;
raw_ptr<apps::AppCapabilityAccessCache, DanglingUntriaged | ExperimentalAsh>
capability_cache_ = nullptr;
raw_ptr<VideoConferenceAppServiceClient, DanglingUntriaged | ExperimentalAsh>
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_service_launcher_unittest.cc b/chrome/browser/chromeos/app_mode/kiosk_app_service_launcher_unittest.cc
index c25f5d0..1a629bf 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_service_launcher_unittest.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_service_launcher_unittest.cc
@@ -92,8 +92,8 @@
app->app_type = kTestAppType;
app->readiness = readiness;
apps.push_back(std::move(app));
- app_service_->AppRegistryCache().OnApps(
- std::move(apps), kTestAppType, /*should_notify_initialized=*/false);
+ app_service_->OnApps(std::move(apps), kTestAppType,
+ /*should_notify_initialized=*/false);
}
apps::AppServiceTest app_service_test_;
diff --git a/chrome/browser/download/notification/download_item_notification_unittest.cc b/chrome/browser/download/notification/download_item_notification_unittest.cc
index af74949b..51deb3c 100644
--- a/chrome/browser/download/notification/download_item_notification_unittest.cc
+++ b/chrome/browser/download/notification/download_item_notification_unittest.cc
@@ -183,10 +183,9 @@
app->policy_ids = {app_id};
apps.push_back(std::move(app));
- apps::AppServiceProxyFactory::GetForProfile(profile_)
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kChromeApp,
- /*should_notify_initialized=*/false);
+ apps::AppServiceProxyFactory::GetForProfile(profile_)->OnApps(
+ std::move(apps), apps::AppType::kChromeApp,
+ /*should_notify_initialized=*/false);
}
#endif
diff --git a/chrome/browser/platform_util_unittest.cc b/chrome/browser/platform_util_unittest.cc
index d1703c9b..fe1a646 100644
--- a/chrome/browser/platform_util_unittest.cc
+++ b/chrome/browser/platform_util_unittest.cc
@@ -136,9 +136,8 @@
app->intent_filters =
apps_util::CreateIntentFiltersForChromeApp(extension.get());
apps.push_back(std::move(app));
- app_service_proxy_->AppRegistryCache().OnApps(
- std::move(apps), apps::AppType::kChromeApp,
- /*should_notify_initialized=*/false);
+ app_service_proxy_->OnApps(std::move(apps), apps::AppType::kChromeApp,
+ /*should_notify_initialized=*/false);
}
void SetUp() override {
diff --git a/chrome/browser/ui/ash/app_access_notifier_unittest.cc b/chrome/browser/ui/ash/app_access_notifier_unittest.cc
index 08816c79..68a2f80 100644
--- a/chrome/browser/ui/ash/app_access_notifier_unittest.cc
+++ b/chrome/browser/ui/ash/app_access_notifier_unittest.cc
@@ -20,14 +20,16 @@
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
+#include "chrome/browser/apps/app_service/app_service_proxy.h"
+#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/account_id/account_id.h"
#include "components/prefs/testing_pref_service.h"
#include "components/services/app_service/public/cpp/app_capability_access_cache.h"
#include "components/services/app_service/public/cpp/app_capability_access_cache_wrapper.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_registry_cache_wrapper.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/capability_access.h"
@@ -210,15 +212,15 @@
bool use_camera,
bool use_microphone,
apps::AppType app_type = apps::AppType::kChromeApp) {
- apps::AppRegistryCache* reg_cache =
- app_access_notifier_->GetActiveUserAppRegistryCache();
+ apps::AppServiceProxy* proxy = apps::AppServiceProxyFactory::GetForProfile(
+ ProfileManager::GetActiveUserProfile());
apps::AppCapabilityAccessCache* cap_cache =
app_access_notifier_->GetActiveUserAppCapabilityAccessCache();
std::vector<apps::AppPtr> registry_deltas;
registry_deltas.push_back(MakeApp(id, name, app_type));
- reg_cache->OnApps(std::move(registry_deltas), apps::AppType::kUnknown,
- /*should_notify_initialized=*/false);
+ proxy->OnApps(std::move(registry_deltas), apps::AppType::kUnknown,
+ /*should_notify_initialized=*/false);
std::vector<apps::CapabilityAccessPtr> capability_access_deltas;
capability_access_deltas.push_back(
diff --git a/chrome/browser/ui/ash/desks/desks_client_browsertest.cc b/chrome/browser/ui/ash/desks/desks_client_browsertest.cc
index b0b1029..f4b6bb3 100644
--- a/chrome/browser/ui/ash/desks/desks_client_browsertest.cc
+++ b/chrome/browser/ui/ash/desks/desks_client_browsertest.cc
@@ -3061,9 +3061,7 @@
std::vector<apps::AppPtr> deltas;
deltas.push_back(
std::make_unique<apps::App>(apps::AppType::kArc, kUnknownTestAppId));
- apps::AppRegistryCacheWrapper::Get()
- .GetAppRegistryCache(
- multi_user_util::GetAccountIdFromProfile(browser()->profile()))
+ apps::AppServiceProxyFactory::GetForProfile(browser()->profile())
->OnApps(std::move(deltas), apps::AppType::kArc,
/*should_notify_initializied=*/false);
diff --git a/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view_browsertest.cc b/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view_browsertest.cc
index abe1595..98431d0 100644
--- a/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view_browsertest.cc
+++ b/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view_browsertest.cc
@@ -190,9 +190,8 @@
fake_apps.push_back(std::move(fake_app));
- app_service_proxy->AppRegistryCache().OnApps(
- std::move(fake_apps), app_type,
- /*should_notify_initialized=*/false);
+ app_service_proxy->OnApps(std::move(fake_apps), app_type,
+ /*should_notify_initialized=*/false);
}
bool VerifyDlp(bool is_dlp_blocked) {
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
index 57c2b45..cd5c3f3 100644
--- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
+++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
@@ -496,10 +496,9 @@
apps.push_back(std::move(app));
- apps::AppServiceProxyFactory::GetForProfile(profile)
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kChromeApp,
- false /* should_notify_initialized */);
+ apps::AppServiceProxyFactory::GetForProfile(profile)->OnApps(
+ std::move(apps), apps::AppType::kChromeApp,
+ false /* should_notify_initialized */);
}
} // namespace
@@ -2567,10 +2566,9 @@
apps::AppPtr app =
std::make_unique<apps::App>(apps::AppType::kChromeApp, extension1_->id());
apps.push_back(std::move(app));
- apps::AppServiceProxyFactory::GetForProfile(profile())
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kChromeApp,
- /*should_notify_initialized=*/false);
+ apps::AppServiceProxyFactory::GetForProfile(profile())->OnApps(
+ std::move(apps), apps::AppType::kChromeApp,
+ /*should_notify_initialized=*/false);
InitShelfController();
@@ -5790,10 +5788,9 @@
std::make_unique<apps::App>(apps::AppType::kChromeApp, extension1_->id());
app->show_in_shelf = false;
apps.push_back(std::move(app));
- apps::AppServiceProxyFactory::GetForProfile(profile())
- ->AppRegistryCache()
- .OnApps(std::move(apps), apps::AppType::kChromeApp,
- false /* should_notify_initialized */);
+ apps::AppServiceProxyFactory::GetForProfile(profile())->OnApps(
+ std::move(apps), apps::AppType::kChromeApp,
+ false /* should_notify_initialized */);
InitShelfController();
EXPECT_EQ("Chrome, App2", GetPinnedAppStatus());
@@ -6224,11 +6221,6 @@
return *image_with_effects.Get()->uncompressed.bitmap();
}
- apps::AppRegistryCache& app_cache() {
- return apps::AppServiceProxyFactory::GetForProfile(profile())
- ->AppRegistryCache();
- }
-
apps::PromiseAppRegistryCache* cache() {
return apps::AppServiceProxyFactory::GetForProfile(profile())
->PromiseAppRegistryCache();
@@ -6419,8 +6411,9 @@
app->readiness = apps::Readiness::kReady;
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_cache().OnApps(std::move(apps), app_type,
- /*should_notify_initialized=*/false);
+ apps::AppServiceProxyFactory::GetForProfile(profile())->OnApps(
+ std::move(apps), app_type,
+ /*should_notify_initialized=*/false);
// Item should no longer be in the shelf.
EXPECT_FALSE(model_->IsAppPinned(package_id.ToString()));
diff --git a/chrome/browser/ui/ash/system_tray_client_impl_browsertest.cc b/chrome/browser/ui/ash/system_tray_client_impl_browsertest.cc
index a12270e..b1345dd 100644
--- a/chrome/browser/ui/ash/system_tray_client_impl_browsertest.cc
+++ b/chrome/browser/ui/ash/system_tray_client_impl_browsertest.cc
@@ -470,9 +470,8 @@
void InstallApp(const char* app_id, const char* name) {
std::vector<apps::AppPtr> registry_deltas;
registry_deltas.push_back(MakeApp(app_id, name));
- proxy()->AppRegistryCache().OnApps(std::move(registry_deltas),
- apps::AppType::kChromeApp,
- /*should_notify_initialized=*/false);
+ proxy()->OnApps(std::move(registry_deltas), apps::AppType::kChromeApp,
+ /*should_notify_initialized=*/false);
}
void SetPreferredApp(const char* app_id) {
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc
index 8628648..3d0b8d60 100644
--- a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc
+++ b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc
@@ -202,9 +202,8 @@
app->intent_filters.push_back(apps_util::MakeIntentFilterForUrlScope(url));
std::vector<apps::AppPtr> apps;
apps.push_back(std::move(app));
- app_service_proxy_->AppRegistryCache().OnApps(
- std::move(apps), apps::AppType::kArc,
- false /* should_notify_initialized */);
+ app_service_proxy_->OnApps(std::move(apps), apps::AppType::kArc,
+ false /* should_notify_initialized */);
return app_id;
}
diff --git a/chrome/browser/ui/webui/ash/settings/pages/apps/app_notification_handler_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/apps/app_notification_handler_unittest.cc
index 3e1db1f..5891d555 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/apps/app_notification_handler_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/apps/app_notification_handler_unittest.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_notification_handler.mojom.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
-#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/permission.h"
#include "content/public/test/browser_task_environment.h"
@@ -171,8 +170,7 @@
void UpdateAppRegistryCache(std::vector<apps::AppPtr>& fake_apps,
apps::AppType app_type) {
- app_service_proxy_->AppRegistryCache().OnApps(std::move(fake_apps),
- app_type, false);
+ app_service_proxy_->OnApps(std::move(fake_apps), app_type, false);
}
bool CheckIfFakeAppInList(std::string fake_id) {
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
index 22c6840..51b309f 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -258,12 +258,11 @@
}
void RegisterWebApp(Profile* profile, apps::AppPtr app) {
- apps::AppRegistryCache& cache =
- apps::AppServiceProxyFactory::GetForProfile(profile)->AppRegistryCache();
std::vector<apps::AppPtr> deltas;
deltas.push_back(std::move(app));
- cache.OnApps(std::move(deltas), apps::AppType::kWeb,
- /*should_notify_initialized=*/true);
+ apps::AppServiceProxyFactory::GetForProfile(profile)->OnApps(
+ std::move(deltas), apps::AppType::kWeb,
+ /*should_notify_initialized=*/true);
}
struct TestModels {
diff --git a/chrome/browser/web_applications/app_service/browser_shortcuts_unittest.cc b/chrome/browser/web_applications/app_service/browser_shortcuts_unittest.cc
index 3899cb2..f67c72f8 100644
--- a/chrome/browser/web_applications/app_service/browser_shortcuts_unittest.cc
+++ b/chrome/browser/web_applications/app_service/browser_shortcuts_unittest.cc
@@ -224,8 +224,8 @@
apps::AppType::kChromeApp, app_constants::kChromeAppId,
apps::Readiness::kReady, "Chrome", apps::InstallReason::kUser,
apps::InstallSource::kSystem));
- proxy->AppRegistryCache().OnApps(std::move(deltas), apps::AppType::kChromeApp,
- /* should_notify_initialized */ true);
+ proxy->OnApps(std::move(deltas), apps::AppType::kChromeApp,
+ /* should_notify_initialized */ true);
base::test::TestFuture<apps::AppLaunchParams, LaunchWebAppWindowSetting>
future;
@@ -288,8 +288,8 @@
apps::AppType::kChromeApp, app_constants::kChromeAppId,
apps::Readiness::kReady, "Chrome", apps::InstallReason::kUser,
apps::InstallSource::kSystem));
- proxy->AppRegistryCache().OnApps(std::move(deltas), apps::AppType::kChromeApp,
- /* should_notify_initialized */ true);
+ proxy->OnApps(std::move(deltas), apps::AppType::kChromeApp,
+ /* should_notify_initialized */ true);
base::test::TestFuture<apps::ShortcutId> future;