| 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> |
| 9 |
| 8 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "chrome/browser/banners/app_banner_manager.h" | 13 #include "chrome/browser/banners/app_banner_manager.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
| 13 | 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. This class owns |
| 17 // This class owns a Java-side AppBannerManager which is used to interface with | 19 // a Java-side AppBannerManager which interfaces with the Java runtime to fetch |
| 18 // the Java runtime for fetching native app data and installing them when | 20 // native app data and install them when requested. |
| 19 // requested. | 21 // |
| 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. |
| 25 // |
| 23 // This class uses that information to request the app's metadata, including an | 26 // This class uses that information to request the app's metadata, including an |
| 24 // icon. If successful, the icon is downloaded and the native app banner shown. | 27 // icon. If successful, the icon is downloaded and the native app banner shown. |
| 25 // Otherwise, if no related applications were detected, or their manifest | 28 // Otherwise, if no related applications were detected, or their manifest |
| 26 // entries were invalid, this class falls back to trying to verify if a web app | 29 // entries were invalid, this class falls back to trying to verify if a web app |
| 27 // banner is suitable. | 30 // banner is suitable. |
| 28 class AppBannerManagerAndroid | 31 class AppBannerManagerAndroid |
| 29 : public AppBannerManager, | 32 : public AppBannerManager, |
| 30 public content::WebContentsUserData<AppBannerManagerAndroid> { | 33 public content::WebContentsUserData<AppBannerManagerAndroid> { |
| 31 public: | 34 public: |
| 32 explicit AppBannerManagerAndroid(content::WebContents* web_contents); | 35 explicit AppBannerManagerAndroid(content::WebContents* web_contents); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 108 |
| 106 // App package name for a native app banner. | 109 // App package name for a native app banner. |
| 107 std::string native_app_package_; | 110 std::string native_app_package_; |
| 108 | 111 |
| 109 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); | 112 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 } // namespace banners | 115 } // namespace banners |
| 113 | 116 |
| 114 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ | 117 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ |
| OLD | NEW |