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

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

Issue 2393513004: Convert app banners to use Mojo. (Closed)
Patch Set: Add TODO Created 4 years, 1 month 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_
7 7
8 #include <memory>
9 #include <string>
10
8 #include "base/android/scoped_java_ref.h" 11 #include "base/android/scoped_java_ref.h"
9 #include "base/macros.h" 12 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
11 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
12 #include "chrome/browser/android/webapk/webapk_metrics.h" 15 #include "chrome/browser/android/webapk/webapk_metrics.h"
13 #include "chrome/browser/banners/app_banner_manager.h"
14 #include "components/infobars/core/confirm_infobar_delegate.h" 16 #include "components/infobars/core/confirm_infobar_delegate.h"
15 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
16 #include "url/gurl.h"
17 18
18 namespace content { 19 namespace content {
19 class WebContents; 20 class WebContents;
20 } 21 }
21 22
22 namespace infobars { 23 namespace infobars {
23 class InfoBarManager; 24 class InfoBarManager;
24 } 25 }
25 26
26 struct ShortcutInfo; 27 struct ShortcutInfo;
27 28
28 namespace banners { 29 namespace banners {
29 30
31 class AppBannerManager;
32
30 // Manages installation of an app being promoted by a page. 33 // Manages installation of an app being promoted by a page.
31 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { 34 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
32 public: 35 public:
33 // Creates an infobar and delegate for promoting the installation of a web 36 // Creates an infobar and delegate for promoting the installation of a web
34 // app, and adds the infobar to the InfoBarManager for |web_contents|. 37 // app, and adds the infobar to the InfoBarManager for |web_contents|.
35 static bool Create( 38 static bool Create(
36 content::WebContents* web_contents, 39 content::WebContents* web_contents,
37 base::WeakPtr<AppBannerManager> weak_manager, 40 base::WeakPtr<AppBannerManager> weak_manager,
38 const base::string16& app_title, 41 const base::string16& app_title,
39 std::unique_ptr<ShortcutInfo> info, 42 std::unique_ptr<ShortcutInfo> info,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 110
108 void CreateJavaDelegate(); 111 void CreateJavaDelegate();
109 bool AcceptNativeApp(content::WebContents* web_contents); 112 bool AcceptNativeApp(content::WebContents* web_contents);
110 bool AcceptWebApp(content::WebContents* web_contents); 113 bool AcceptWebApp(content::WebContents* web_contents);
111 114
112 // Called when the OK button on a WebAPK infobar is pressed. If the WebAPK is 115 // Called when the OK button on a WebAPK infobar is pressed. If the WebAPK is
113 // already installed, opens it; otherwise, installs it. Returns whether the 116 // already installed, opens it; otherwise, installs it. Returns whether the
114 // infobar should be closed as a result of the button press. 117 // infobar should be closed as a result of the button press.
115 bool AcceptWebApk(content::WebContents* web_contents); 118 bool AcceptWebApk(content::WebContents* web_contents);
116 119
117 void SendBannerAccepted(content::WebContents* web_contents, 120 void SendBannerAccepted();
118 const std::string& platform);
119 void OnWebApkInstallFinished(bool success, 121 void OnWebApkInstallFinished(bool success,
120 const std::string& webapk_package_name); 122 const std::string& webapk_package_name);
121 void TrackWebApkInstallationDismissEvents(InstallState install_state); 123 void TrackWebApkInstallationDismissEvents(InstallState install_state);
122 124
123 // ConfirmInfoBarDelegate: 125 // ConfirmInfoBarDelegate:
124 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 126 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
125 gfx::Image GetIcon() const override; 127 gfx::Image GetIcon() const override;
126 void InfoBarDismissed() override; 128 void InfoBarDismissed() override;
127 base::string16 GetMessageText() const override; 129 base::string16 GetMessageText() const override;
128 int GetButtons() const override; 130 int GetButtons() const override;
(...skipping 30 matching lines...) Expand all
159 161
160 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); 162 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid);
161 }; 163 };
162 164
163 // Register native methods. 165 // Register native methods.
164 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); 166 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env);
165 167
166 } // namespace banners 168 } // namespace banners
167 169
168 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ 170 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/android/banners/app_banner_infobar_delegate_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698