OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ |
6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_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/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/android/shortcut_info.h" | 12 #include "chrome/browser/android/shortcut_info.h" |
13 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 struct Manifest; | 17 struct Manifest; |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 class GURL; | 21 class GURL; |
22 struct InstallableData; | 22 struct InstallableData; |
23 class WebApkIconHasher; | |
24 | 23 |
25 // WebApkUpdateDataFetcher is the C++ counterpart of | 24 // WebApkUpdateDataFetcher is the C++ counterpart of |
26 // org.chromium.chrome.browser's WebApkUpdateDataFetcher in Java. It is created | 25 // org.chromium.chrome.browser's WebApkUpdateDataFetcher in Java. It is created |
27 // via a JNI (Initialize) call and MUST BE DESTROYED via Destroy(). | 26 // via a JNI (Initialize) call and MUST BE DESTROYED via Destroy(). |
28 class WebApkUpdateDataFetcher : public content::WebContentsObserver { | 27 class WebApkUpdateDataFetcher : public content::WebContentsObserver { |
29 public: | 28 public: |
30 WebApkUpdateDataFetcher(JNIEnv* env, | 29 WebApkUpdateDataFetcher(JNIEnv* env, |
31 jobject obj, | 30 jobject obj, |
32 const GURL& scope, | 31 const GURL& scope, |
33 const GURL& web_manifest_url); | 32 const GURL& web_manifest_url); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 79 |
81 // The WebAPK's Web Manifest URL that the detector is looking for. | 80 // The WebAPK's Web Manifest URL that the detector is looking for. |
82 const GURL web_manifest_url_; | 81 const GURL web_manifest_url_; |
83 | 82 |
84 // Whether this is the initial URL fetch. | 83 // Whether this is the initial URL fetch. |
85 bool is_initial_fetch_; | 84 bool is_initial_fetch_; |
86 | 85 |
87 // The URL for which the installable data is being fetched / was last fetched. | 86 // The URL for which the installable data is being fetched / was last fetched. |
88 GURL last_fetched_url_; | 87 GURL last_fetched_url_; |
89 | 88 |
90 // Downloads app icon and computes Murmur2 hash. | |
91 std::unique_ptr<WebApkIconHasher> icon_hasher_; | |
92 | |
93 // Downloaded data for |web_manifest_url_|. | 89 // Downloaded data for |web_manifest_url_|. |
94 ShortcutInfo info_; | 90 ShortcutInfo info_; |
95 SkBitmap best_primary_icon_; | 91 SkBitmap best_primary_icon_; |
96 | 92 |
97 base::WeakPtrFactory<WebApkUpdateDataFetcher> weak_ptr_factory_; | 93 base::WeakPtrFactory<WebApkUpdateDataFetcher> weak_ptr_factory_; |
98 | 94 |
99 DISALLOW_COPY_AND_ASSIGN(WebApkUpdateDataFetcher); | 95 DISALLOW_COPY_AND_ASSIGN(WebApkUpdateDataFetcher); |
100 }; | 96 }; |
101 | 97 |
102 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ | 98 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ |
OLD | NEW |