| 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_DATA_FETCHER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_DATA_FETCHER_ANDROID_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_DATA_FETCHER_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_DATA_FETCHER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "chrome/browser/banners/app_banner_data_fetcher.h" | 11 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
| 11 | 12 |
| 12 namespace banners { | 13 namespace banners { |
| 13 | 14 |
| 14 // Fetches data required to show a banner for the URL currently shown by the | 15 // Fetches data required to show a banner for the URL currently shown by the |
| 15 // WebContents. Extends the regular fetch to add support for Android apps. | 16 // WebContents. Extends the regular fetch to add support for Android apps. |
| 16 class AppBannerDataFetcherAndroid : public AppBannerDataFetcher { | 17 class AppBannerDataFetcherAndroid : public AppBannerDataFetcher { |
| 17 public: | 18 public: |
| 18 AppBannerDataFetcherAndroid(content::WebContents* web_contents, | 19 AppBannerDataFetcherAndroid(content::WebContents* web_contents, |
| 19 base::WeakPtr<Delegate> weak_delegate, | 20 base::WeakPtr<Delegate> weak_delegate, |
| 20 int ideal_icon_size_in_dp, | 21 int ideal_icon_size_in_dp, |
| 21 int minimum_icon_size_in_dp, | 22 int minimum_icon_size_in_dp, |
| 22 int ideal_splash_image_size_in_dp, | 23 int ideal_splash_image_size_in_dp, |
| 23 int minimum_splash_image_size_in_dp, | 24 int minimum_splash_image_size_in_dp, |
| 24 bool is_debug_mode); | 25 bool is_debug_mode); |
| 25 | 26 |
| 26 // Saves information about the Android app being promoted by the current page, | 27 // Saves information about the Android app being promoted by the current page, |
| 27 // then continues the creation pipeline. | 28 // then continues the creation pipeline. |
| 28 bool ContinueFetching(const base::string16& app_title, | 29 bool ContinueFetching(const base::string16& app_title, |
| 29 const std::string& app_package, | 30 const std::string& app_package, |
| 30 const base::android::JavaRef<jobject>& app_data, | 31 const base::android::JavaRef<jobject>& app_data, |
| 31 const GURL& image_url); | 32 const GURL& image_url); |
| 32 | 33 |
| 33 // Fetches the splash screen image and stores it in the WebappDataStorage. | 34 // Returns a callback which fetches the splash screen image and stores it in |
| 34 void FetchWebappSplashScreenImage(const std::string& webapp_id); | 35 // WebappDataStorage. |
| 36 base::Closure FetchWebappSplashScreenImageCallback( |
| 37 const std::string& webapp_id); |
| 35 | 38 |
| 36 protected: | 39 protected: |
| 37 ~AppBannerDataFetcherAndroid() override; | 40 ~AppBannerDataFetcherAndroid() override; |
| 38 | 41 |
| 39 std::string GetBannerType() override; | 42 std::string GetBannerType() override; |
| 40 std::string GetAppIdentifier() override; | 43 std::string GetAppIdentifier() override; |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 void ShowBanner(const SkBitmap* icon, | 46 void ShowBanner(const SkBitmap* icon, |
| 44 const base::string16& title, | 47 const base::string16& title, |
| 45 const std::string& referrer) override; | 48 const std::string& referrer) override; |
| 46 | 49 |
| 47 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; | 50 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; |
| 48 std::string native_app_package_; | 51 std::string native_app_package_; |
| 49 | 52 |
| 50 int ideal_splash_image_size_in_dp_; | 53 int ideal_splash_image_size_in_dp_; |
| 51 int minimum_splash_image_size_in_dp_; | 54 int minimum_splash_image_size_in_dp_; |
| 52 | 55 |
| 53 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcherAndroid); | 56 DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcherAndroid); |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 } // namespace banners | 59 } // namespace banners |
| 57 | 60 |
| 58 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_DATA_FETCHER_ANDROID_H_ | 61 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_DATA_FETCHER_ANDROID_H_ |
| OLD | NEW |