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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // content::WebContentsObserver: | 54 // content::WebContentsObserver: |
55 void DidStopLoading() override; | 55 void DidStopLoading() override; |
56 | 56 |
57 // Fetches the installable data. | 57 // Fetches the installable data. |
58 void FetchInstallableData(); | 58 void FetchInstallableData(); |
59 | 59 |
60 // Called once the installable data has been fetched. | 60 // Called once the installable data has been fetched. |
61 void OnDidGetInstallableData(const InstallableData& installable_data); | 61 void OnDidGetInstallableData(const InstallableData& installable_data); |
62 | 62 |
63 // Called with the computed Murmur2 hash for the app icon. | 63 // Called with the computed Murmur2 hash for the primary icon. |
64 void OnGotIconMurmur2Hash(const std::string& best_primary_icon_murmur2_hash); | 64 void OnGotPrimaryIconMurmur2Hash(const std::string& primary_icon_hash); |
65 | 65 |
66 void OnDataAvailable(const ShortcutInfo& info, | 66 void OnDataAvailable(const std::string& primary_icon_murmur2_hash, |
67 const std::string& best_primary_icon_murmur2_hash, | 67 bool did_fetch_badge_icon, |
68 const SkBitmap& best_primary_icon); | 68 const std::string& badge_icon_murmur2_hash); |
69 | 69 |
70 // Called when a page has no Web Manifest or the Web Manifest is not WebAPK | 70 // Called when a page has no Web Manifest or the Web Manifest is not WebAPK |
71 // compatible. | 71 // compatible. |
72 void OnWebManifestNotWebApkCompatible(); | 72 void OnWebManifestNotWebApkCompatible(); |
73 | 73 |
74 // Points to the Java object. | 74 // Points to the Java object. |
75 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 75 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
76 | 76 |
77 // The detector will only fetch the URL within the scope of the WebAPK. | 77 // The detector will only fetch the URL within the scope of the WebAPK. |
78 const GURL scope_; | 78 const GURL scope_; |
79 | 79 |
80 // 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. |
81 const GURL web_manifest_url_; | 81 const GURL web_manifest_url_; |
82 | 82 |
83 // Whether this is the initial URL fetch. | 83 // Whether this is the initial URL fetch. |
84 bool is_initial_fetch_; | 84 bool is_initial_fetch_; |
85 | 85 |
86 // 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. |
87 GURL last_fetched_url_; | 87 GURL last_fetched_url_; |
88 | 88 |
89 // Downloaded data for |web_manifest_url_|. | 89 // Downloaded data for |web_manifest_url_|. |
90 ShortcutInfo info_; | 90 ShortcutInfo info_; |
91 SkBitmap best_primary_icon_; | 91 SkBitmap primary_icon_; |
| 92 SkBitmap badge_icon_; |
92 | 93 |
93 base::WeakPtrFactory<WebApkUpdateDataFetcher> weak_ptr_factory_; | 94 base::WeakPtrFactory<WebApkUpdateDataFetcher> weak_ptr_factory_; |
94 | 95 |
95 DISALLOW_COPY_AND_ASSIGN(WebApkUpdateDataFetcher); | 96 DISALLOW_COPY_AND_ASSIGN(WebApkUpdateDataFetcher); |
96 }; | 97 }; |
97 | 98 |
98 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ | 99 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_ |
OLD | NEW |