OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
7 | 7 |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_weak_ref.h" | 9 #include "base/android/jni_weak_ref.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // process of showing a banner for the package designated by |tag_content| on | 123 // process of showing a banner for the package designated by |tag_content| on |
124 // the page at the |expected_url|. | 124 // the page at the |expected_url|. |
125 void OnDidRetrieveMetaTagContent(bool success, | 125 void OnDidRetrieveMetaTagContent(bool success, |
126 const std::string& tag_name, | 126 const std::string& tag_name, |
127 const std::string& tag_content, | 127 const std::string& tag_content, |
128 const GURL& expected_url); | 128 const GURL& expected_url); |
129 | 129 |
130 // Called when the result of the CheckHasServiceWorker query has completed. | 130 // Called when the result of the CheckHasServiceWorker query has completed. |
131 void OnDidCheckHasServiceWorker(bool has_same); | 131 void OnDidCheckHasServiceWorker(bool has_same); |
132 | 132 |
| 133 // Update the record of banner events and check if the banner should be shown. |
| 134 bool CheckIfShouldShow(const std::string& package_or_start_url); |
| 135 |
133 // Fetches the icon for an app. | 136 // Fetches the icon for an app. |
134 scoped_ptr<chrome::BitmapFetcher> fetcher_; | 137 scoped_ptr<chrome::BitmapFetcher> fetcher_; |
135 GURL validated_url_; | 138 GURL validated_url_; |
136 content::Manifest manifest_; | 139 content::Manifest manifest_; |
137 scoped_ptr<SkBitmap> app_icon_; | 140 scoped_ptr<SkBitmap> app_icon_; |
138 | 141 |
139 // AppBannerManager on the Java side. | 142 // AppBannerManager on the Java side. |
140 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; | 143 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; |
141 | 144 |
142 // A weak pointer is used as the lifetime of the ServiceWorkerContext is | 145 // A weak pointer is used as the lifetime of the ServiceWorkerContext is |
143 // longer than the lifetime of this banner manager. The banner manager | 146 // longer than the lifetime of this banner manager. The banner manager |
144 // might be gone when calls sent to the ServiceWorkerContext are completed. | 147 // might be gone when calls sent to the ServiceWorkerContext are completed. |
145 base::WeakPtrFactory<AppBannerManager> weak_factory_; | 148 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
146 | 149 |
147 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 150 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
148 }; // class AppBannerManager | 151 }; // class AppBannerManager |
149 | 152 |
150 // Register native methods | 153 // Register native methods |
151 bool RegisterAppBannerManager(JNIEnv* env); | 154 bool RegisterAppBannerManager(JNIEnv* env); |
152 | 155 |
153 } // namespace banners | 156 } // namespace banners |
154 | 157 |
155 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ | 158 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |