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/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/android/banners/app_banner_infobar_delegate.h" | 13 #include "chrome/browser/android/banners/app_banner_infobar_delegate.h" |
12 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 14 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
13 #include "chrome/browser/ui/android/infobars/app_banner_infobar.h" | 15 #include "chrome/browser/ui/android/infobars/app_banner_infobar.h" |
14 #include "components/infobars/core/infobar_manager.h" | 16 #include "components/infobars/core/infobar_manager.h" |
15 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/common/manifest.h" | 18 #include "content/public/common/manifest.h" |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 struct FrameNavigateParams; | 21 struct FrameNavigateParams; |
20 struct LoadCommittedDetails; | 22 struct LoadCommittedDetails; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 128 |
127 // Called when the renderer has returned information about the meta tag. | 129 // Called when the renderer has returned information about the meta tag. |
128 // If there is some metadata for the play store tag, this kicks off the | 130 // If there is some metadata for the play store tag, this kicks off the |
129 // process of showing a banner for the package designated by |tag_content| on | 131 // process of showing a banner for the package designated by |tag_content| on |
130 // the page at the |expected_url|. | 132 // the page at the |expected_url|. |
131 void OnDidRetrieveMetaTagContent(bool success, | 133 void OnDidRetrieveMetaTagContent(bool success, |
132 const std::string& tag_name, | 134 const std::string& tag_name, |
133 const std::string& tag_content, | 135 const std::string& tag_content, |
134 const GURL& expected_url); | 136 const GURL& expected_url); |
135 | 137 |
| 138 // Called when the result of the CheckHasServiceWorker query has completed. |
| 139 void OnDidCheckHasServiceWorker(bool has_service_worker); |
| 140 |
136 // Fetches the icon for an app. | 141 // Fetches the icon for an app. |
137 scoped_ptr<chrome::BitmapFetcher> fetcher_; | 142 scoped_ptr<chrome::BitmapFetcher> fetcher_; |
138 GURL validated_url_; | 143 GURL validated_url_; |
139 GURL app_icon_url_; | 144 GURL app_icon_url_; |
140 | 145 |
141 base::string16 app_title_; | 146 base::string16 app_title_; |
142 scoped_ptr<SkBitmap> app_icon_; | 147 scoped_ptr<SkBitmap> app_icon_; |
143 | 148 |
144 content::Manifest web_app_data_; | 149 content::Manifest web_app_data_; |
145 | 150 |
146 // Weak pointer to the InfoBar that is being managed. | 151 // Weak pointer to the InfoBar that is being managed. |
147 AppBannerInfoBar* weak_infobar_ptr_; | 152 AppBannerInfoBar* weak_infobar_ptr_; |
148 | 153 |
149 // AppBannerManager on the Java side. | 154 // AppBannerManager on the Java side. |
150 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; | 155 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; |
151 | 156 |
| 157 // A weak pointer is used as the lifetime of the ServiceWorkerContext is |
| 158 // longer than the lifetime of this banner manager. The banner manager |
| 159 // might be gone when calls sent to the ServiceWorkerContext are completed. |
| 160 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
| 161 |
152 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 162 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
153 }; // class AppBannerManager | 163 }; // class AppBannerManager |
154 | 164 |
155 // Register native methods | 165 // Register native methods |
156 bool RegisterAppBannerManager(JNIEnv* env); | 166 bool RegisterAppBannerManager(JNIEnv* env); |
157 | 167 |
158 } // namespace banners | 168 } // namespace banners |
159 | 169 |
160 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ | 170 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |