| 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_MANAGER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Returns a callback which fetches the splash screen image and stores it in | 59 // Returns a callback which fetches the splash screen image and stores it in |
| 60 // a WebappDataStorage. | 60 // a WebappDataStorage. |
| 61 base::Closure FetchWebappSplashScreenImageCallback( | 61 base::Closure FetchWebappSplashScreenImageCallback( |
| 62 const std::string& webapp_id) override; | 62 const std::string& webapp_id) override; |
| 63 | 63 |
| 64 // Registers native methods. | 64 // Registers native methods. |
| 65 static bool Register(JNIEnv* env); | 65 static bool Register(JNIEnv* env); |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 // Return the ideal badge icon size. |
| 69 int GetIdealBadgeIconSizeInPx(); |
| 70 |
| 68 // AppBannerManager overrides. | 71 // AppBannerManager overrides. |
| 69 std::string GetAppIdentifier() override; | 72 std::string GetAppIdentifier() override; |
| 70 std::string GetBannerType() override; | 73 std::string GetBannerType() override; |
| 71 int GetIdealIconSizeInPx() override; | 74 int GetIdealPrimaryIconSizeInPx() override; |
| 72 int GetMinimumIconSizeInPx() override; | 75 int GetMinimumPrimaryIconSizeInPx() override; |
| 73 bool IsWebAppInstalled(content::BrowserContext* browser_context, | 76 bool IsWebAppInstalled(content::BrowserContext* browser_context, |
| 74 const GURL& start_url, | 77 const GURL& start_url, |
| 75 const GURL& manifest_url) override; | 78 const GURL& manifest_url) override; |
| 79 InstallableParams ParamsToPerformInstallableCheck() override; |
| 76 void PerformInstallableCheck() override; | 80 void PerformInstallableCheck() override; |
| 81 void OnDidPerformInstallableCheck(const InstallableData& result) override; |
| 77 void OnAppIconFetched(const SkBitmap& bitmap) override; | 82 void OnAppIconFetched(const SkBitmap& bitmap) override; |
| 78 void ResetCurrentPageData() override; | 83 void ResetCurrentPageData() override; |
| 79 void ShowBanner() override; | 84 void ShowBanner() override; |
| 80 | 85 |
| 81 private: | 86 private: |
| 82 friend class content::WebContentsUserData<AppBannerManagerAndroid>; | 87 friend class content::WebContentsUserData<AppBannerManagerAndroid>; |
| 83 | 88 |
| 84 // Creates the Java-side AppBannerManager. | 89 // Creates the Java-side AppBannerManager. |
| 85 void CreateJavaBannerManager(); | 90 void CreateJavaBannerManager(); |
| 86 | 91 |
| 87 // Returns true if |platform| and |id| are valid for querying the Play Store. | 92 // Returns true if |platform| and |id| are valid for querying the Play Store. |
| 88 bool CheckPlatformAndId(const std::string& platform, | 93 bool CheckPlatformAndId(const std::string& platform, |
| 89 const std::string& id); | 94 const std::string& id); |
| 90 | 95 |
| 91 // Returns the query value for |name| in |url|, e.g. example.com?name=value. | 96 // Returns the query value for |name| in |url|, e.g. example.com?name=value. |
| 92 std::string ExtractQueryValueForName(const GURL& url, | 97 std::string ExtractQueryValueForName(const GURL& url, |
| 93 const std::string& name); | 98 const std::string& name); |
| 94 | 99 |
| 95 // Returns true if |platform|, |url|, and |id| are consistent and can be used | 100 // Returns true if |platform|, |url|, and |id| are consistent and can be used |
| 96 // to query the Play Store for a native app. The query may not necessarily | 101 // to query the Play Store for a native app. The query may not necessarily |
| 97 // succeed (e.g. |id| doesn't map to anything), but if this method returns | 102 // succeed (e.g. |id| doesn't map to anything), but if this method returns |
| 98 // true, only a native app banner may be shown, and the web app banner flow | 103 // true, only a native app banner may be shown, and the web app banner flow |
| 99 // will not be run. | 104 // will not be run. |
| 100 bool CanHandleNonWebApp(const std::string& platform, | 105 bool CanHandleNonWebApp(const std::string& platform, |
| 101 const GURL& url, | 106 const GURL& url, |
| 102 const std::string& id); | 107 const std::string& id); |
| 103 | 108 |
| 109 // The URL of the badge icon. |
| 110 GURL badge_icon_url_; |
| 111 |
| 112 // The badge icon object. |
| 113 std::unique_ptr<SkBitmap> badge_icon_; |
| 114 |
| 104 // The Java-side AppBannerManager. | 115 // The Java-side AppBannerManager. |
| 105 base::android::ScopedJavaGlobalRef<jobject> java_banner_manager_; | 116 base::android::ScopedJavaGlobalRef<jobject> java_banner_manager_; |
| 106 | 117 |
| 107 // Java-side object containing data about a native app. | 118 // Java-side object containing data about a native app. |
| 108 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; | 119 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; |
| 109 | 120 |
| 110 // App package name for a native app banner. | 121 // App package name for a native app banner. |
| 111 std::string native_app_package_; | 122 std::string native_app_package_; |
| 112 | 123 |
| 124 // Whether WebAPKs can be installed. |
| 125 bool can_install_webapk_; |
| 126 |
| 113 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); | 127 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); |
| 114 }; | 128 }; |
| 115 | 129 |
| 116 } // namespace banners | 130 } // namespace banners |
| 117 | 131 |
| 118 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ | 132 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ |
| OLD | NEW |