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

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

Issue 2402903002: Make the timing of ManifestUpgradeDetectorFetcher::Start() call less subtle (Closed)
Patch Set: Created 4 years, 2 months 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/manifest_upgrade_detector_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/manifest_upgrade_detector_fetcher.cc
diff --git a/chrome/browser/android/webapk/manifest_upgrade_detector_fetcher.cc b/chrome/browser/android/webapk/manifest_upgrade_detector_fetcher.cc
index 00bc822b24ef915518e65b5d1050bbf7f173aed1..bff110e56371604385b77ad3f308b8e9f283d69b 100644
--- a/chrome/browser/android/webapk/manifest_upgrade_detector_fetcher.cc
+++ b/chrome/browser/android/webapk/manifest_upgrade_detector_fetcher.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
#include "chrome/browser/installable/installable_manager.h"
#include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/manifest.h"
#include "jni/ManifestUpgradeDetectorFetcher_jni.h"
@@ -87,14 +86,24 @@ void ManifestUpgradeDetectorFetcher::Start(
const JavaParamRef<jobject>& obj,
const JavaParamRef<jobject>& java_web_contents) {
ReplaceWebContents(env, obj, java_web_contents);
+ if (!web_contents()->IsLoading())
+ FetchInstallableData();
}
-void ManifestUpgradeDetectorFetcher::DidFinishLoad(
- content::RenderFrameHost* render_frame_host,
- const GURL& validated_url) {
- if (render_frame_host->GetParent())
+void ManifestUpgradeDetectorFetcher::DidStopLoading() {
+ FetchInstallableData();
+}
+
+void ManifestUpgradeDetectorFetcher::FetchInstallableData() {
+ GURL url = web_contents()->GetLastCommittedURL();
+
+ // DidStopLoading() can be called multiple times for a single URL. Only fetch
+ // installable data the first time.
+ if (url == last_fetched_url_)
return;
- if (!IsInScope(validated_url, scope_))
+ last_fetched_url_ = url;
+
+ if (!IsInScope(url, scope_))
return;
InstallableParams params;
« no previous file with comments | « chrome/browser/android/webapk/manifest_upgrade_detector_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698