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 "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
14 #include "content/public/common/manifest.h" | 16 #include "content/public/common/manifest.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 struct FrameNavigateParams; | 19 struct FrameNavigateParams; |
18 struct LoadCommittedDetails; | 20 struct LoadCommittedDetails; |
19 struct Manifest; | 21 struct Manifest; |
20 } // namespace content | 22 } // namespace content |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 120 |
119 // Called when the renderer has returned information about the meta tag. | 121 // Called when the renderer has returned information about the meta tag. |
120 // If there is some metadata for the play store tag, this kicks off the | 122 // If there is some metadata for the play store tag, this kicks off the |
121 // 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 |
122 // the page at the |expected_url|. | 124 // the page at the |expected_url|. |
123 void OnDidRetrieveMetaTagContent(bool success, | 125 void OnDidRetrieveMetaTagContent(bool success, |
124 const std::string& tag_name, | 126 const std::string& tag_name, |
125 const std::string& tag_content, | 127 const std::string& tag_content, |
126 const GURL& expected_url); | 128 const GURL& expected_url); |
127 | 129 |
| 130 // Called when the result of the CheckHasSameServiceWorker query has |
| 131 // completed. |
| 132 void OnDidCheckHasSameServiceWorker(bool has_same); |
| 133 |
128 // Fetches the icon for an app. | 134 // Fetches the icon for an app. |
129 scoped_ptr<chrome::BitmapFetcher> fetcher_; | 135 scoped_ptr<chrome::BitmapFetcher> fetcher_; |
130 GURL validated_url_; | 136 GURL validated_url_; |
131 content::Manifest manifest_; | 137 content::Manifest manifest_; |
132 scoped_ptr<SkBitmap> app_icon_; | 138 scoped_ptr<SkBitmap> app_icon_; |
133 | 139 |
134 // AppBannerManager on the Java side. | 140 // AppBannerManager on the Java side. |
135 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; | 141 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; |
136 | 142 |
| 143 // A weak pointer is used as the lifetime of the ServiceWorkerContext is |
| 144 // longer than the lifetime of this banner manager. The banner manager |
| 145 // might be gone when calls sent to the ServiceWorkerContext are completed. |
| 146 base::WeakPtrFactory<AppBannerManager> weak_factory_; |
| 147 |
137 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); | 148 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); |
138 }; // class AppBannerManager | 149 }; // class AppBannerManager |
139 | 150 |
140 // Register native methods | 151 // Register native methods |
141 bool RegisterAppBannerManager(JNIEnv* env); | 152 bool RegisterAppBannerManager(JNIEnv* env); |
142 | 153 |
143 } // namespace banners | 154 } // namespace banners |
144 | 155 |
145 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ | 156 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ |
OLD | NEW |