Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: chrome/browser/android/webapk/webapk_update_data_fetcher.h

Issue 2460253002: Update WebAPKs even if the WebAPK start URL has no Web Manifest part 2/3 (Closed)
Patch Set: Merge branch 'master' into update_fail_refactor0 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_MANIFEST_UPGRADE_DETECTOR_FETCHER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_
6 #define CHROME_BROWSER_ANDROID_WEBAPK_MANIFEST_UPGRADE_DETECTOR_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; 23 class WebApkIconHasher;
24 24
25 // ManifestUpgradeDetectorFetcher is the C++ counterpart of 25 // WebApkUpdateDataFetcher is the C++ counterpart of
26 // org.chromium.chrome.browser's ManifestUpgradeDetectorFetcher in Java. It is 26 // org.chromium.chrome.browser's WebApkUpdateDataFetcher in Java. It is created
27 // created via a JNI (Initialize) call and MUST BE DESTROYED via Destroy(). 27 // via a JNI (Initialize) call and MUST BE DESTROYED via Destroy().
28 class ManifestUpgradeDetectorFetcher : public content::WebContentsObserver { 28 class WebApkUpdateDataFetcher : public content::WebContentsObserver {
29 public: 29 public:
30 ManifestUpgradeDetectorFetcher(JNIEnv* env, 30 WebApkUpdateDataFetcher(JNIEnv* env,
31 jobject obj, 31 jobject obj,
32 const GURL& scope, 32 const GURL& scope,
33 const GURL& web_manifest_url); 33 const GURL& web_manifest_url);
34 34
35 // Replaces the WebContents that is being observed. 35 // Replaces the WebContents that is being observed.
36 void ReplaceWebContents( 36 void ReplaceWebContents(
37 JNIEnv* env, 37 JNIEnv* env,
38 const base::android::JavaParamRef<jobject>& obj, 38 const base::android::JavaParamRef<jobject>& obj,
39 const base::android::JavaParamRef<jobject>& java_web_contents); 39 const base::android::JavaParamRef<jobject>& java_web_contents);
40 40
41 // Called by the Java counterpart to destroy its native half. 41 // Called by the Java counterpart to destroy its native half.
42 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 42 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
43 43
44 // Called by the Java counterpart to start checking web manifest changes. 44 // Called by the Java counterpart to start checking web manifest changes.
45 void Start(JNIEnv* env, 45 void Start(JNIEnv* env,
46 const base::android::JavaParamRef<jobject>& obj, 46 const base::android::JavaParamRef<jobject>& obj,
47 const base::android::JavaParamRef<jobject>& java_web_contents); 47 const base::android::JavaParamRef<jobject>& java_web_contents);
48 48
49 // Registers JNI hooks. 49 // Registers JNI hooks.
50 static bool Register(JNIEnv* env); 50 static bool Register(JNIEnv* env);
51 51
52 private: 52 private:
53 ~ManifestUpgradeDetectorFetcher() override; 53 ~WebApkUpdateDataFetcher() override;
54 54
55 // content::WebContentsObserver: 55 // content::WebContentsObserver:
56 void DidStopLoading() override; 56 void DidStopLoading() override;
57 57
58 // Fetches the installable data. 58 // Fetches the installable data.
59 void FetchInstallableData(); 59 void FetchInstallableData();
60 60
61 // Called once the installable data has been fetched. 61 // Called once the installable data has been fetched.
62 void OnDidGetInstallableData(const InstallableData& installable_data); 62 void OnDidGetInstallableData(const InstallableData& installable_data);
63 63
(...skipping 16 matching lines...) Expand all
80 // The URL for which the installable data is being fetched / was last fetched. 80 // The URL for which the installable data is being fetched / was last fetched.
81 GURL last_fetched_url_; 81 GURL last_fetched_url_;
82 82
83 // Downloads app icon and computes Murmur2 hash. 83 // Downloads app icon and computes Murmur2 hash.
84 std::unique_ptr<WebApkIconHasher> icon_hasher_; 84 std::unique_ptr<WebApkIconHasher> icon_hasher_;
85 85
86 // Downloaded data for |web_manifest_url_|. 86 // Downloaded data for |web_manifest_url_|.
87 ShortcutInfo info_; 87 ShortcutInfo info_;
88 SkBitmap best_icon_; 88 SkBitmap best_icon_;
89 89
90 base::WeakPtrFactory<ManifestUpgradeDetectorFetcher> weak_ptr_factory_; 90 base::WeakPtrFactory<WebApkUpdateDataFetcher> weak_ptr_factory_;
91 91
92 DISALLOW_COPY_AND_ASSIGN(ManifestUpgradeDetectorFetcher); 92 DISALLOW_COPY_AND_ASSIGN(WebApkUpdateDataFetcher);
93 }; 93 };
94 94
95 #endif // CHROME_BROWSER_ANDROID_WEBAPK_MANIFEST_UPGRADE_DETECTOR_FETCHER_H_ 95 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_UPDATE_DATA_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698