| OLD | NEW |
| 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/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h" |
| 10 #include "components/infobars/core/confirm_infobar_delegate.h" | 11 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 11 #include "content/public/common/manifest.h" | 12 #include "content/public/common/manifest.h" |
| 12 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class WebContents; | 17 class WebContents; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace infobars { | 20 namespace infobars { |
| 20 class InfoBarManager; | 21 class InfoBarManager; |
| 21 } // namespace infobars | 22 } // namespace infobars |
| 22 | 23 |
| 23 class AppBannerInfoBar; | 24 class AppBannerInfoBar; |
| 24 | 25 |
| 25 namespace banners { | 26 namespace banners { |
| 26 | 27 |
| 27 // Manages installation of an app being promoted by a webpage. | 28 // Manages installation of an app being promoted by a webpage. |
| 28 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { | 29 class AppBannerInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
| 29 public: | 30 public: |
| 30 // Delegate for promoting a web app. | 31 // Delegate for promoting a web app. |
| 31 AppBannerInfoBarDelegateAndroid( | 32 AppBannerInfoBarDelegateAndroid( |
| 32 int event_request_id, | 33 int event_request_id, |
| 34 scoped_refptr<AppBannerDataFetcherAndroid> data_fetcher, |
| 33 const base::string16& app_title, | 35 const base::string16& app_title, |
| 34 SkBitmap* app_icon, | 36 SkBitmap* app_icon, |
| 35 const content::Manifest& web_app_data); | 37 const content::Manifest& web_app_data); |
| 36 | 38 |
| 37 // Delegate for promoting an Android app. | 39 // Delegate for promoting an Android app. |
| 38 AppBannerInfoBarDelegateAndroid( | 40 AppBannerInfoBarDelegateAndroid( |
| 39 int event_request_id, | 41 int event_request_id, |
| 40 const base::string16& app_title, | 42 const base::string16& app_title, |
| 41 SkBitmap* app_icon, | 43 SkBitmap* app_icon, |
| 42 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, | 44 const base::android::ScopedJavaGlobalRef<jobject>& native_app_data, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 67 // ConfirmInfoBarDelegate: | 69 // ConfirmInfoBarDelegate: |
| 68 gfx::Image GetIcon() const override; | 70 gfx::Image GetIcon() const override; |
| 69 void InfoBarDismissed() override; | 71 void InfoBarDismissed() override; |
| 70 base::string16 GetMessageText() const override; | 72 base::string16 GetMessageText() const override; |
| 71 int GetButtons() const override; | 73 int GetButtons() const override; |
| 72 bool Accept() override; | 74 bool Accept() override; |
| 73 bool LinkClicked(WindowOpenDisposition disposition) override; | 75 bool LinkClicked(WindowOpenDisposition disposition) override; |
| 74 | 76 |
| 75 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; | 77 base::android::ScopedJavaGlobalRef<jobject> java_delegate_; |
| 76 | 78 |
| 79 int event_request_id_; |
| 80 |
| 81 // Used to fetch the splashscreen icon for webapps. |
| 82 scoped_refptr<AppBannerDataFetcherAndroid> data_fetcher_; |
| 83 |
| 77 base::string16 app_title_; | 84 base::string16 app_title_; |
| 78 scoped_ptr<SkBitmap> app_icon_; | 85 scoped_ptr<SkBitmap> app_icon_; |
| 79 | 86 |
| 80 int event_request_id_; | |
| 81 content::Manifest web_app_data_; | 87 content::Manifest web_app_data_; |
| 82 | 88 |
| 83 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; | 89 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; |
| 84 std::string native_app_package_; | 90 std::string native_app_package_; |
| 85 std::string referrer_; | 91 std::string referrer_; |
| 86 bool has_user_interaction_; | 92 bool has_user_interaction_; |
| 87 | 93 |
| 88 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); | 94 DISALLOW_COPY_AND_ASSIGN(AppBannerInfoBarDelegateAndroid); |
| 89 }; // AppBannerInfoBarDelegateAndroid | 95 }; // AppBannerInfoBarDelegateAndroid |
| 90 | 96 |
| 91 // Register native methods. | 97 // Register native methods. |
| 92 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); | 98 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env); |
| 93 | 99 |
| 94 } // namespace banners | 100 } // namespace banners |
| 95 | 101 |
| 96 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ | 102 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_INFOBAR_DELEGATE_ANDROID_H_ |
| OLD | NEW |