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 "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/banners/app_banner_manager.h" | 11 #include "chrome/browser/banners/app_banner_manager.h" |
12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
13 | 13 |
| 14 struct ShortcutInfo; |
| 15 |
14 namespace banners { | 16 namespace banners { |
15 | 17 |
16 // Extends the AppBannerManager to support native Android apps. | 18 // Extends the AppBannerManager to support native Android apps. |
17 // This class owns a Java-side AppBannerManager which is used to interface with | 19 // This class owns a Java-side AppBannerManager which is used to interface with |
18 // the Java runtime for fetching native app data and installing them when | 20 // the Java runtime for fetching native app data and installing them when |
19 // requested. | 21 // requested. |
20 // A site requests a native app banner by setting "prefer_related_applications" | 22 // A site requests a native app banner by setting "prefer_related_applications" |
21 // to true in its manifest, and providing at least one related application for | 23 // to true in its manifest, and providing at least one related application for |
22 // the "play" platform with a Play Store ID. | 24 // the "play" platform with a Play Store ID. |
23 // This class uses that information to request the app's metadata, including an | 25 // This class uses that information to request the app's metadata, including an |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 92 |
91 // Returns true if |platform|, |url|, and |id| are consistent and can be used | 93 // Returns true if |platform|, |url|, and |id| are consistent and can be used |
92 // to query the Play Store for a native app. The query may not necessarily | 94 // to query the Play Store for a native app. The query may not necessarily |
93 // succeed (e.g. |id| doesn't map to anything), but if this method returns | 95 // succeed (e.g. |id| doesn't map to anything), but if this method returns |
94 // true, only a native app banner may be shown, and the web app banner flow | 96 // true, only a native app banner may be shown, and the web app banner flow |
95 // will not be run. | 97 // will not be run. |
96 bool CanHandleNonWebApp(const std::string& platform, | 98 bool CanHandleNonWebApp(const std::string& platform, |
97 const GURL& url, | 99 const GURL& url, |
98 const std::string& id); | 100 const std::string& id); |
99 | 101 |
| 102 // Create shortcut info from the Web Manifest for a web app. |
| 103 std::unique_ptr<ShortcutInfo> CreateShortcutInfo(); |
| 104 |
100 // The Java-side AppBannerManager. | 105 // The Java-side AppBannerManager. |
101 base::android::ScopedJavaGlobalRef<jobject> java_banner_manager_; | 106 base::android::ScopedJavaGlobalRef<jobject> java_banner_manager_; |
102 | 107 |
103 // Java-side object containing data about a native app. | 108 // Java-side object containing data about a native app. |
104 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; | 109 base::android::ScopedJavaGlobalRef<jobject> native_app_data_; |
105 | 110 |
106 // App package name for a native app banner. | 111 // App package name for a native app banner. |
107 std::string native_app_package_; | 112 std::string native_app_package_; |
108 | 113 |
109 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); | 114 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace banners | 117 } // namespace banners |
113 | 118 |
114 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ | 119 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ |
OLD | NEW |