blob: a7527c0f1d91c659d887825a46c173b171bc6699 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "chrome/browser/web_applications/components/web_app_tab_helper_base.h"
namespace content {
class WebContents;
namespace extensions {
class Extension;
// Allows to associate a tab with bookmark app.
class BookmarkAppTabHelper : public web_app::WebAppTabHelperBase {
explicit BookmarkAppTabHelper(content::WebContents* web_contents);
~BookmarkAppTabHelper() override;
// Should only be called through WebAppProvider::CreateTabHelper which ensures
// the right tab helper is created based on the DesktopPWAsWithoutExtensions
// feature.
static BookmarkAppTabHelper* CreateForWebContents(
content::WebContents* web_contents);
// WebAppTabHelperBase:
web_app::WebAppTabHelperBase* CloneForWebContents(
content::WebContents* web_contents) const override;
web_app::AppId GetAppId(const GURL& url) override;
bool IsInAppWindow() const override;
bool IsUserInstalled() const override;
bool IsFromInstallButton() const override;
// Get a pointer from app_id_. Semantically, we use app_id_ as a weak
// reference. It might become nullptr in unforeseen circumstances (Uninstall).
// TODO(loyso): Provide guarantees for app_id_.
const Extension* GetExtension() const;
} // namespace extensions