| 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" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/banners/app_banner_manager.h" | 14 #include "chrome/browser/banners/app_banner_manager.h" |
| 14 #include "content/public/browser/web_contents_user_data.h" | 15 #include "content/public/browser/web_contents_user_data.h" |
| 15 | 16 |
| 16 namespace banners { | 17 namespace banners { |
| 17 | 18 |
| 18 // Extends the AppBannerManager to support native Android apps. This class owns | 19 // Extends the AppBannerManager to support native Android apps. This class owns |
| 19 // a Java-side AppBannerManager which interfaces with the Java runtime to fetch | 20 // a Java-side AppBannerManager which interfaces with the Java runtime to fetch |
| 20 // native app data and install them when requested. | 21 // native app data and install them when requested. |
| 21 // | 22 // |
| 22 // A site requests a native app banner by setting "prefer_related_applications" | 23 // A site requests a native app banner by setting "prefer_related_applications" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 // Returns true if |platform|, |url|, and |id| are consistent and can be used | 96 // 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 | 97 // 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 | 98 // 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 | 99 // true, only a native app banner may be shown, and the web app banner flow |
| 99 // will not be run. | 100 // will not be run. |
| 100 bool CanHandleNonWebApp(const std::string& platform, | 101 bool CanHandleNonWebApp(const std::string& platform, |
| 101 const GURL& url, | 102 const GURL& url, |
| 102 const std::string& id); | 103 const std::string& id); |
| 103 | 104 |
| 105 // Called by |ShowBanner()| which may check whether the WebAPK Install API is |
| 106 // availabel asynchrously. |
| 107 void ShowBannerImpl(content::WebContents* contents, |
| 108 bool can_use_webapk_install_flow); |
| 109 |
| 110 // Called when the check of whether the Google Play Install API is available |
| 111 // is done. |
| 112 void OnCanUseGooglePlayInstallApi(content::WebContents* contents, |
| 113 bool can_use_webapk_install_flow); |
| 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 base::WeakPtrFactory<AppBannerManagerAndroid> weak_ptr_factory_; |
| 125 |
| 113 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); | 126 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); |
| 114 }; | 127 }; |
| 115 | 128 |
| 116 } // namespace banners | 129 } // namespace banners |
| 117 | 130 |
| 118 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ | 131 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ |
| OLD | NEW |