Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/strings/string16.h" | |
| 9 #include "components/infobars/core/confirm_infobar_delegate.h" | |
| 10 #include "ui/gfx/image/image.h" | |
| 11 #include "url/gurl.h" | |
| 12 | |
| 13 class InfoBarService; | |
| 14 | |
| 15 namespace banners { | |
| 16 | |
| 17 // Displays information about an app being promoted by a webpage. | |
| 18 class AppBannerInfoBarDelegate : public ConfirmInfoBarDelegate { | |
| 19 public: | |
| 20 // 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.
| |
| 21 class AppDelegate { | |
| 22 public: | |
| 23 // User has elected to block the banner from being displayed. | |
| 24 virtual void Block() const = 0; | |
| 25 | |
| 26 // User has requested that the app be installed. | |
| 27 virtual void Install() const = 0; | |
| 28 | |
| 29 // Icon to display for the app. | |
| 30 virtual gfx::Image GetIcon() const = 0; | |
| 31 }; | |
| 32 | |
| 33 // Creates a banner for the current page. | |
| 34 static infobars::InfoBar* CreateForWebApp(InfoBarService* infobar_service, | |
| 35 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.
| |
| 36 const base::string16& app_title, | |
| 37 const GURL& url); | |
| 38 | |
| 39 // Changes the label of the button. | |
| 40 void SetButtonLabel(const std::string& button_text); | |
| 41 | |
| 42 // InfoBarDelegate overrides. | |
| 43 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.
| |
| 44 virtual void InfoBarDismissed() override; | |
| 45 | |
| 46 // ConfirmInfoBarDelegate overrides. | |
| 47 virtual base::string16 GetMessageText() const override; | |
| 48 virtual int GetButtons() const override; | |
| 49 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; | |
| 50 virtual bool Accept() override; | |
| 51 | |
| 52 private: | |
| 53 // Constructor for a banner for web apps. | |
| 54 AppBannerInfoBarDelegate(const AppDelegate* helper, | |
| 55 const base::string16& app_title, | |
| 56 const GURL& url); | |
| 57 | |
| 58 ~AppBannerInfoBarDelegate() override; | |
| 59 | |
| 60 const AppDelegate* delegate_; | |
| 61 base::string16 app_title_; | |
| 62 GURL url_; | |
| 63 base::string16 button_text_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegate); | |
| 66 }; // AppBannerInfoBarDelegate | |
| 67 | |
| 68 } // namespace banners | |
| 69 | |
| 70 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |