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