Daniel Murphy | ee53ac5b | 2023-04-14 15:16:39 | [diff] [blame] | 1 | // Copyright 2023 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/web_applications/locks/with_app_resources.h" |
| 6 | |
| 7 | #include "chrome/browser/web_applications/locks/web_app_lock_manager.h" |
| 8 | #include "chrome/browser/web_applications/web_app_provider.h" |
| 9 | |
| 10 | namespace web_app { |
| 11 | |
| 12 | WithAppResources::~WithAppResources() = default; |
| 13 | |
Dibyajyoti Pal | 7b3a132 | 2023-09-13 21:02:22 | [diff] [blame] | 14 | ExtensionsManager& WithAppResources::extensions_manager() { |
| 15 | CHECK(lock_manager_); |
| 16 | return lock_manager_->provider().extensions_manager(); |
| 17 | } |
Zelin Liu | 4ac2607 | 2023-09-20 19:13:29 | [diff] [blame] | 18 | IsolatedWebAppInstallationManager& |
| 19 | WithAppResources::isolated_web_app_installation_manager() { |
| 20 | CHECK(lock_manager_); |
| 21 | return lock_manager_->provider().isolated_web_app_installation_manager(); |
| 22 | } |
Daniel Murphy | ee53ac5b | 2023-04-14 15:16:39 | [diff] [blame] | 23 | WebAppRegistrar& WithAppResources::registrar() { |
| 24 | CHECK(lock_manager_); |
| 25 | return lock_manager_->provider().registrar_unsafe(); |
| 26 | } |
| 27 | WebAppSyncBridge& WithAppResources::sync_bridge() { |
| 28 | CHECK(lock_manager_); |
| 29 | return lock_manager_->provider().sync_bridge_unsafe(); |
| 30 | } |
| 31 | WebAppInstallFinalizer& WithAppResources::install_finalizer() { |
| 32 | CHECK(lock_manager_); |
| 33 | return lock_manager_->provider().install_finalizer(); |
| 34 | } |
| 35 | OsIntegrationManager& WithAppResources::os_integration_manager() { |
| 36 | CHECK(lock_manager_); |
| 37 | return lock_manager_->provider().os_integration_manager(); |
| 38 | } |
| 39 | WebAppInstallManager& WithAppResources::install_manager() { |
| 40 | CHECK(lock_manager_); |
| 41 | return lock_manager_->provider().install_manager(); |
| 42 | } |
| 43 | WebAppIconManager& WithAppResources::icon_manager() { |
| 44 | CHECK(lock_manager_); |
| 45 | return lock_manager_->provider().icon_manager(); |
| 46 | } |
| 47 | WebAppTranslationManager& WithAppResources::translation_manager() { |
| 48 | CHECK(lock_manager_); |
| 49 | return lock_manager_->provider().translation_manager(); |
| 50 | } |
| 51 | WebAppUiManager& WithAppResources::ui_manager() { |
| 52 | CHECK(lock_manager_); |
| 53 | return lock_manager_->provider().ui_manager(); |
| 54 | } |
Lu Huang | ed7019e9 | 2023-04-19 02:04:22 | [diff] [blame] | 55 | WebAppOriginAssociationManager& WithAppResources::origin_association_manager() { |
| 56 | CHECK(lock_manager_); |
| 57 | return lock_manager_->provider().origin_association_manager(); |
| 58 | } |
Daniel Murphy | 51461d5 | 2024-10-04 19:57:26 | [diff] [blame] | 59 | |
| 60 | WithAppResources::WithAppResources() = default; |
| 61 | |
| 62 | void WithAppResources::GrantWithAppResources(WebAppLockManager& lock_manager) { |
| 63 | lock_manager_ = lock_manager.GetWeakPtr(); |
| 64 | } |
Daniel Murphy | ee53ac5b | 2023-04-14 15:16:39 | [diff] [blame] | 65 | |
| 66 | } // namespace web_app |