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

Unified Diff: chrome/browser/android/webapk/webapk_update_data_fetcher.cc

Issue 2594813002: Update WebAPKs even if the WebAPK start URL has no Web Manifest (Closed)
Patch Set: Nits. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/webapk/webapk_update_data_fetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/webapk/webapk_update_data_fetcher.cc
diff --git a/chrome/browser/android/webapk/webapk_update_data_fetcher.cc b/chrome/browser/android/webapk/webapk_update_data_fetcher.cc
index a5a20efebe050d58bcb9d3074a7fff60b8fd0524..df08252e2cc54be95799152d6d24409d3fd72b30 100644
--- a/chrome/browser/android/webapk/webapk_update_data_fetcher.cc
+++ b/chrome/browser/android/webapk/webapk_update_data_fetcher.cc
@@ -55,6 +55,7 @@ WebApkUpdateDataFetcher::WebApkUpdateDataFetcher(
: content::WebContentsObserver(nullptr),
scope_(scope),
web_manifest_url_(web_manifest_url),
+ is_initial_fetch_(false),
info_(GURL()),
weak_ptr_factory_(this) {
java_ref_.Reset(env, obj);
@@ -102,10 +103,13 @@ void WebApkUpdateDataFetcher::FetchInstallableData() {
// installable data the first time.
if (url == last_fetched_url_)
return;
+ is_initial_fetch_ = last_fetched_url_.is_empty();
last_fetched_url_ = url;
- if (!IsInScope(url, scope_))
+ if (!IsInScope(url, scope_)) {
+ OnWebManifestNotWebApkCompatible();
return;
+ }
InstallableParams params;
params.ideal_icon_size_in_dp =
@@ -133,13 +137,14 @@ void WebApkUpdateDataFetcher::OnDidGetInstallableData(
// observing too. It is based on our assumption that it is invalid for
// web developers to change the Web Manifest location. When it does
// change, we will treat the new Web Manifest as the one of another WebAPK.
- if (data.manifest.IsEmpty() || web_manifest_url_ != data.manifest_url)
+ if (data.manifest.IsEmpty() || web_manifest_url_ != data.manifest_url) {
+ OnWebManifestNotWebApkCompatible();
return;
+ }
- // TODO(pkotwicz): Tell Java side that the Web Manifest was fetched but the
- // Web Manifest is not WebAPK-compatible. (http://crbug.com/639536)
if (data.error_code != NO_ERROR_DETECTED ||
Xi Han 2016/12/20 20:53:23 I believe Peter splited them as two checks because
dominickn 2016/12/21 02:14:32 The comment can be very easily changed to incorpor
Xi Han 2016/12/21 22:25:11 All right, merge them together. I re-order these c
!AreWebManifestUrlsWebApkCompatible(data.manifest)) {
+ OnWebManifestNotWebApkCompatible();
return;
}
@@ -163,8 +168,7 @@ void WebApkUpdateDataFetcher::OnGotIconMurmur2Hash(
icon_hasher_.reset();
if (best_icon_murmur2_hash.empty()) {
- // TODO(pkotwicz): Tell Java side that the Web Manifest was fetched but the
- // Web Manifest is not WebAPK-compatible. (http://crbug.com/639536)
+ OnWebManifestNotWebApkCompatible();
return;
}
@@ -201,3 +205,11 @@ void WebApkUpdateDataFetcher::OnDataAvailable(
java_icon_urls, info.display, info.orientation, info.theme_color,
info.background_color);
}
+
+void WebApkUpdateDataFetcher::OnWebManifestNotWebApkCompatible() {
+ if (!is_initial_fetch_)
+ return;
+
+ Java_WebApkUpdateDataFetcher_onWebManifestForInitialUrlNotWebApkCompatible(
+ base::android::AttachCurrentThread(), java_ref_);
+}
« no previous file with comments | « chrome/browser/android/webapk/webapk_update_data_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698