Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: chrome/browser/android/banners/app_banner_infobar_delegate.h

Issue 893073002: Start showing basic infobars for manifest apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 grabbing info about an
21 // app.
22 class AppDelegate {
23 public:
24 // User has elected to block the banner from being displayed.
25 virtual void Block() const = 0;
26
27 // User has requested that the app be installed.
28 virtual void Install() const = 0;
29
30 // Icon to display for the app.
31 virtual gfx::Image GetIcon() const = 0;
32 };
33
34 // Creates a banner for the current page.
35 // May return nullptr if the the infobar couldn't be created.
36 static infobars::InfoBar* CreateForWebApp(InfoBarService* infobar_service,
37 const AppDelegate* helper,
38 const base::string16& app_title,
39 const GURL& url);
40
41 // Changes the label of the button.
42 void SetButtonLabel(const std::string& button_text);
43
44 // InfoBarDelegate overrides.
45 gfx::Image GetIcon() const override;
46 void InfoBarDismissed() override;
47
48 // ConfirmInfoBarDelegate overrides.
49 base::string16 GetMessageText() const override;
50 int GetButtons() const override;
51 base::string16 GetButtonLabel(InfoBarButton button) const override;
52 bool Accept() override;
53
54 private:
55 // Constructor for a banner for web apps.
56 AppBannerInfoBarDelegate(const AppDelegate* helper,
57 const base::string16& app_title,
58 const GURL& url);
59
60 ~AppBannerInfoBarDelegate() override;
61
62 const AppDelegate* delegate_;
63 base::string16 app_title_;
64 GURL url_;
65 base::string16 button_text_;
66
67 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegate);
68 }; // AppBannerInfoBarDelegate
69
70 } // namespace banners
71
72 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/android/banners/app_banner_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698