Skip to content

Commit

Permalink
WebAppProvider: registrar() const
Browse files Browse the repository at this point in the history
We add a const method returning a const reference
to the WebAppRegistrar.

Change-Id: Ie64981001e13efd3fd03d750b8550e918ba0ddcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222321
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Reviewed-by: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/main@{#931849}
  • Loading branch information
ericwilligers authored and Chromium LUCI CQ committed Oct 15, 2021
1 parent 3466077 commit 9b241cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chrome/browser/badging/badge_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ BadgeManager::FrameBindingContext::GetAppIdsAndUrlsForBadging() const {
if (!contents)
return std::vector<std::tuple<web_app::AppId, GURL>>{};

auto* provider = WebAppProvider::GetForLocalAppsUnchecked(
const WebAppProvider* provider = WebAppProvider::GetForLocalAppsUnchecked(
Profile::FromBrowserContext(contents->GetBrowserContext()));
if (!provider)
return std::vector<std::tuple<web_app::AppId, GURL>>{};
Expand All @@ -275,7 +275,7 @@ BadgeManager::ServiceWorkerBindingContext::GetAppIdsAndUrlsForBadging() const {
if (!render_process_host)
return std::vector<std::tuple<web_app::AppId, GURL>>{};

auto* provider = WebAppProvider::GetForLocalAppsUnchecked(
const WebAppProvider* provider = WebAppProvider::GetForLocalAppsUnchecked(
Profile::FromBrowserContext(render_process_host->GetBrowserContext()));
if (!provider)
return std::vector<std::tuple<web_app::AppId, GURL>>{};
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/web_applications/web_app_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ WebAppRegistrar& WebAppProvider::registrar() {
return *registrar_;
}

const WebAppRegistrar& WebAppProvider::registrar() const {
CheckIsConnected();
return *registrar_;
}

WebAppSyncBridge& WebAppProvider::sync_bridge() {
CheckIsConnected();
return *sync_bridge_;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/web_applications/web_app_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class WebAppProvider : public KeyedService {

// The app registry model.
WebAppRegistrar& registrar();
const WebAppRegistrar& registrar() const;
// The app registry controller.
WebAppSyncBridge& sync_bridge();
// UIs can use WebAppInstallManager for user-initiated Web Apps install.
Expand Down

0 comments on commit 9b241cc

Please sign in to comment.