Chromium Code Reviews| Index: chrome/browser/android/banners/app_banner_infobar_delegate.h |
| diff --git a/chrome/browser/android/banners/app_banner_infobar_delegate.h b/chrome/browser/android/banners/app_banner_infobar_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6ea1ae9edbe465e0720aa1b83aefc3b4d131315c |
| --- /dev/null |
| +++ b/chrome/browser/android/banners/app_banner_infobar_delegate.h |
| @@ -0,0 +1,70 @@ |
| +// Copyright 2015 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. |
| + |
| +#ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_ |
| +#define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_ |
| + |
| +#include "base/strings/string16.h" |
| +#include "components/infobars/core/confirm_infobar_delegate.h" |
| +#include "ui/gfx/image/image.h" |
| +#include "url/gurl.h" |
| + |
| +class InfoBarService; |
| + |
| +namespace banners { |
| + |
| +// Displays information about an app being promoted by a webpage. |
| +class AppBannerInfoBarDelegate : public ConfirmInfoBarDelegate { |
| + public: |
| + // Handles calls dealing with blocking, promoting, or grab info about an app. |
|
newt (away)
2015/02/03 00:57:24
s/grab/grabbing
gone
2015/02/03 01:18:16
Done.
|
| + class AppDelegate { |
| + public: |
| + // User has elected to block the banner from being displayed. |
| + virtual void Block() const = 0; |
| + |
| + // User has requested that the app be installed. |
| + virtual void Install() const = 0; |
| + |
| + // Icon to display for the app. |
| + virtual gfx::Image GetIcon() const = 0; |
| + }; |
| + |
| + // Creates a banner for the current page. |
| + static infobars::InfoBar* CreateForWebApp(InfoBarService* infobar_service, |
| + const AppDelegate* helper, |
|
newt (away)
2015/02/03 00:57:24
s/helper/delegate ?
Also, document the return val
gone
2015/02/03 01:18:16
Done.
|
| + const base::string16& app_title, |
| + const GURL& url); |
| + |
| + // Changes the label of the button. |
| + void SetButtonLabel(const std::string& button_text); |
| + |
| + // InfoBarDelegate overrides. |
| + virtual gfx::Image GetIcon() const override; |
|
newt (away)
2015/02/03 00:57:25
New style guide: don't use virtual with override.
gone
2015/02/03 01:18:16
Done.
|
| + virtual void InfoBarDismissed() override; |
| + |
| + // ConfirmInfoBarDelegate overrides. |
| + virtual base::string16 GetMessageText() const override; |
| + virtual int GetButtons() const override; |
| + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; |
| + virtual bool Accept() override; |
| + |
| + private: |
| + // Constructor for a banner for web apps. |
| + AppBannerInfoBarDelegate(const AppDelegate* helper, |
| + const base::string16& app_title, |
| + const GURL& url); |
| + |
| + ~AppBannerInfoBarDelegate() override; |
| + |
| + const AppDelegate* delegate_; |
| + base::string16 app_title_; |
| + GURL url_; |
| + base::string16 button_text_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegate); |
| +}; // AppBannerInfoBarDelegate |
| + |
| +} // namespace banners |
| + |
| +#endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_ |