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

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

Issue 2156113002: Replace AppBannerDataFetcher with InstallableManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-refactor
Patch Set: Naming, includes Created 4 years, 4 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 "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h" 12 #include "chrome/browser/banners/app_banner_manager.h"
12 #include "components/infobars/core/confirm_infobar_delegate.h" 13 #include "components/infobars/core/confirm_infobar_delegate.h"
13 #include "content/public/common/manifest.h" 14 #include "content/public/common/manifest.h"
14 #include "ui/gfx/image/image.h" 15 #include "ui/gfx/image/image.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace content { 18 namespace content {
18 class WebContents; 19 class WebContents;
19 } 20 }
20 21
21 namespace infobars { 22 namespace infobars {
22 class InfoBarManager; 23 class InfoBarManager;
23 } // namespace infobars 24 }
24 25
25 class AppBannerInfoBar; 26 class AppBannerInfoBar;
26 27
27 namespace banners { 28 namespace banners {
28 29
29 // Manages installation of an app being promoted by a webpage. 30 // Manages installation of an app being promoted by a page.
30 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { 31 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate {
31 public: 32 public:
32 // Delegate for promoting a web app. 33 // Delegate for promoting a web app.
33 AppBannerInfoBarDelegateAndroid( 34 AppBannerInfoBarDelegateAndroid(
34 int event_request_id, 35 base::WeakPtr<AppBannerManager> weak_manager,
35 scoped_refptr<AppBannerDataFetcherAndroid> data_fetcher,
36 const base::string16& app_title, 36 const base::string16& app_title,
37 const GURL& app_icon_url,
38 SkBitmap* app_icon,
39 const GURL& manifest_url, 37 const GURL& manifest_url,
40 const content::Manifest& manifest); 38 const content::Manifest& manifest,
39 const GURL& icon_url,
40 std::unique_ptr<SkBitmap> icon,
41 int event_request_id);
41 42
42 // Delegate for promoting an Android app. 43 // Delegate for promoting an Android app.
43 AppBannerInfoBarDelegateAndroid( 44 AppBannerInfoBarDelegateAndroid(
44 int event_request_id,
45 const base::string16& app_title, 45 const base::string16& app_title,
46 SkBitmap* app_icon,
47 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, 46 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data,
47 std::unique_ptr<SkBitmap> icon,
48 const std::string& native_app_package, 48 const std::string& native_app_package,
49 const std::string& referrer); 49 const std::string& referrer,
50 int event_request_id);
50 51
51 ~AppBannerInfoBarDelegateAndroid() override; 52 ~AppBannerInfoBarDelegateAndroid() override;
52 53
53 // Called when the AppBannerInfoBar's button needs to be updated. 54 // Called when the AppBannerInfoBar's button needs to be updated.
54 void UpdateInstallState(JNIEnv* env, 55 void UpdateInstallState(JNIEnv* env,
55 const base::android::JavaParamRef<jobject>& obj); 56 const base::android::JavaParamRef<jobject>& obj);
56 57
57 // Called when the installation Intent has been handled and focus has been 58 // Called when the installation Intent has been handled and focus has been
58 // returned to Chrome. 59 // returned to Chrome.
59 void OnInstallIntentReturned(JNIEnv* env, 60 void OnInstallIntentReturned(JNIEnv* env,
(...skipping 15 matching lines...) Expand all
75 gfx::Image GetIcon() const override; 76 gfx::Image GetIcon() const override;
76 void InfoBarDismissed() override; 77 void InfoBarDismissed() override;
77 base::string16 GetMessageText() const override; 78 base::string16 GetMessageText() const override;
78 int GetButtons() const override; 79 int GetButtons() const override;
79 bool Accept() override; 80 bool Accept() override;
80 bool LinkClicked(WindowOpenDisposition disposition) override; 81 bool LinkClicked(WindowOpenDisposition disposition) override;
81 82
82 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; 83 base::android::ScopedJavaGlobalRef<jobject> java_delegate_;
83 84
84 // Used to fetch the splash screen icon for webapps. 85 // Used to fetch the splash screen icon for webapps.
85 scoped_refptr<AppBannerDataFetcherAndroid> data_fetcher_; 86 base::WeakPtr<AppBannerManager> weak_manager_;
86 87
87 base::string16 app_title_; 88 base::string16 app_title_;
88 GURL app_icon_url_;
89 std::unique_ptr<SkBitmap> app_icon_;
90
91 int event_request_id_;
92 GURL manifest_url_; 89 GURL manifest_url_;
93 content::Manifest manifest_; 90 content::Manifest manifest_;
94 91
95 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; 92 base::android::ScopedJavaGlobalRef<jobject> native_app_data_;
93
94 GURL icon_url_;
95 std::unique_ptr<SkBitmap> icon_;
96
96 std::string native_app_package_; 97 std::string native_app_package_;
97 std::string referrer_; 98 std::string referrer_;
99 int event_request_id_;
98 bool has_user_interaction_; 100 bool has_user_interaction_;
99 101
100 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); 102 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid);
101 }; // AppBannerInfoBarDelegateAndroid 103 }; // AppBannerInfoBarDelegateAndroid
102 104
103 // Register native methods. 105 // Register native methods.
104 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); 106 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env);
105 107
106 } // namespace banners 108 } // namespace banners
107 109
108 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ 110 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698