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

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: Rebase Created 4 years, 2 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
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" 18 #include "url/gurl.h"
17 19
18 namespace content { 20 namespace content {
19 class WebContents; 21 class WebContents;
20 } 22 }
21 23
22 namespace infobars { 24 namespace infobars {
23 class InfoBarManager; 25 class InfoBarManager;
24 } 26 }
25 27
26 class AppBannerInfoBar; 28 class AppBannerInfoBar;
27 struct ShortcutInfo; 29 struct ShortcutInfo;
28 30
29 namespace banners { 31 namespace banners {
30 32
33 class AppBannerManager;
34
31 // Manages installation of an app being promoted by a page. 35 // Manages installation of an app being promoted by a page.
32 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { 36 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
33 public: 37 public:
34 // Creates an infobar and delegate for promoting the installation of a web 38 // Creates an infobar and delegate for promoting the installation of a web
35 // app, and adds the infobar to the InfoBarManager for |web_contents|. 39 // app, and adds the infobar to the InfoBarManager for |web_contents|.
36 static bool Create( 40 static bool Create(
37 content::WebContents* web_contents, 41 content::WebContents* web_contents,
38 base::WeakPtr<AppBannerManager> weak_manager, 42 base::WeakPtr<AppBannerManager> weak_manager,
39 const base::string16& app_title, 43 const base::string16& app_title,
40 std::unique_ptr<ShortcutInfo> info, 44 std::unique_ptr<ShortcutInfo> info,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool AcceptNativeApp(content::WebContents* web_contents); 112 bool AcceptNativeApp(content::WebContents* web_contents);
109 bool AcceptWebApp(content::WebContents* web_contents); 113 bool AcceptWebApp(content::WebContents* web_contents);
110 114
111 // When user accepts to install a WebAPK, this function sends a request 115 // When user accepts to install a WebAPK, this function sends a request
112 // to the WebAPK Server to create a WebAPK and install it. It returns 116 // to the WebAPK Server to create a WebAPK and install it. It returns
113 // false to prevent infobar from disappearing when installation starts. 117 // false to prevent infobar from disappearing when installation starts.
114 // When user clicks the Open button after the intallation is compelete, this 118 // When user clicks the Open button after the intallation is compelete, this
115 // function launches the installed WebAPK and returns true. 119 // function launches the installed WebAPK and returns true.
116 bool AcceptWebApk(content::WebContents* web_contents); 120 bool AcceptWebApk(content::WebContents* web_contents);
117 121
118 void SendBannerAccepted(content::WebContents* web_contents, 122 void SendBannerAccepted();
119 const std::string& platform);
120 void OnWebApkInstallFinished(bool success, const std::string& webapk_package); 123 void OnWebApkInstallFinished(bool success, const std::string& webapk_package);
121 void TrackWebApkInstallationDismissEvents(InstallState install_state); 124 void TrackWebApkInstallationDismissEvents(InstallState install_state);
122 125
123 // ConfirmInfoBarDelegate: 126 // ConfirmInfoBarDelegate:
124 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 127 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
125 gfx::Image GetIcon() const override; 128 gfx::Image GetIcon() const override;
126 void InfoBarDismissed() override; 129 void InfoBarDismissed() override;
127 base::string16 GetMessageText() const override; 130 base::string16 GetMessageText() const override;
128 int GetButtons() const override; 131 int GetButtons() const override;
129 bool LinkClicked(WindowOpenDisposition disposition) override; 132 bool LinkClicked(WindowOpenDisposition disposition) override;
(...skipping 29 matching lines...) Expand all
159 162
160 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); 163 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid);
161 }; 164 };
162 165
163 // Register native methods. 166 // Register native methods.
164 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); 167 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env);
165 168
166 } // namespace banners 169 } // namespace banners
167 170
168 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ 171 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698