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 | } |
Daniel Murphy | ee53ac5b | 2023-04-14 15:16:39 | [diff] [blame] | 18 | WebAppRegistrar& WithAppResources::registrar() { |
| 19 | CHECK(lock_manager_); |
| 20 | return lock_manager_->provider().registrar_unsafe(); |
| 21 | } |
| 22 | WebAppSyncBridge& WithAppResources::sync_bridge() { |
| 23 | CHECK(lock_manager_); |
| 24 | return lock_manager_->provider().sync_bridge_unsafe(); |
| 25 | } |
| 26 | WebAppInstallFinalizer& WithAppResources::install_finalizer() { |
| 27 | CHECK(lock_manager_); |
| 28 | return lock_manager_->provider().install_finalizer(); |
| 29 | } |
| 30 | OsIntegrationManager& WithAppResources::os_integration_manager() { |
| 31 | CHECK(lock_manager_); |
| 32 | return lock_manager_->provider().os_integration_manager(); |
| 33 | } |
| 34 | WebAppInstallManager& WithAppResources::install_manager() { |
| 35 | CHECK(lock_manager_); |
| 36 | return lock_manager_->provider().install_manager(); |
| 37 | } |
| 38 | WebAppIconManager& WithAppResources::icon_manager() { |
| 39 | CHECK(lock_manager_); |
| 40 | return lock_manager_->provider().icon_manager(); |
| 41 | } |
| 42 | WebAppTranslationManager& WithAppResources::translation_manager() { |
| 43 | CHECK(lock_manager_); |
| 44 | return lock_manager_->provider().translation_manager(); |
| 45 | } |
| 46 | WebAppUiManager& WithAppResources::ui_manager() { |
| 47 | CHECK(lock_manager_); |
| 48 | return lock_manager_->provider().ui_manager(); |
| 49 | } |
Lu Huang | ed7019e9 | 2023-04-19 02:04:22 | [diff] [blame] | 50 | WebAppOriginAssociationManager& WithAppResources::origin_association_manager() { |
| 51 | CHECK(lock_manager_); |
| 52 | return lock_manager_->provider().origin_association_manager(); |
| 53 | } |
Daniel Murphy | ee53ac5b | 2023-04-14 15:16:39 | [diff] [blame] | 54 | WithAppResources::WithAppResources( |
| 55 | base::WeakPtr<WebAppLockManager> lock_manager) |
| 56 | : lock_manager_(std::move(lock_manager)) {} |
| 57 | |
| 58 | } // namespace web_app |