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

Unified Diff: content/renderer/manifest/manifest_manager.cc

Issue 2140463002: Remove WebContents::HasManifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explanatory comment for manifest_url_ resetting Created 4 years, 5 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 | « content/renderer/manifest/manifest_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/manifest/manifest_manager.cc
diff --git a/content/renderer/manifest/manifest_manager.cc b/content/renderer/manifest/manifest_manager.cc
index 6e7823606de6b59d14b343aadfc16e7a5ba8a76f..e23c99af395f6c5ef4a65342a0c7d23838ec9bd0 100644
--- a/content/renderer/manifest/manifest_manager.cc
+++ b/content/renderer/manifest/manifest_manager.cc
@@ -38,7 +38,6 @@ bool ManifestManager::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ManifestManager, message)
- IPC_MESSAGE_HANDLER(ManifestManagerMsg_HasManifest, OnHasManifest)
IPC_MESSAGE_HANDLER(ManifestManagerMsg_RequestManifest, OnRequestManifest)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -46,14 +45,6 @@ bool ManifestManager::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void ManifestManager::OnHasManifest(int request_id) {
- GURL url(render_frame()->GetWebFrame()->document().manifestURL());
-
- bool has_manifest = may_have_manifest_ && !url.is_empty();
- Send(new ManifestManagerHostMsg_HasManifestResponse(
- routing_id(), request_id, has_manifest));
-}
-
void ManifestManager::OnRequestManifest(int request_id) {
GetManifest(base::Bind(&ManifestManager::OnRequestManifestComplete,
base::Unretained(this), request_id));
@@ -115,6 +106,7 @@ void ManifestManager::GetManifest(const GetManifestCallback& callback) {
void ManifestManager::DidChangeManifest() {
may_have_manifest_ = true;
manifest_dirty_ = true;
+ manifest_url_ = GURL();
}
void ManifestManager::DidCommitProvisionalLoad(
@@ -125,18 +117,19 @@ void ManifestManager::DidCommitProvisionalLoad(
may_have_manifest_ = false;
manifest_dirty_ = true;
+ manifest_url_ = GURL();
}
void ManifestManager::FetchManifest() {
- GURL url(render_frame()->GetWebFrame()->document().manifestURL());
+ manifest_url_ = render_frame()->GetWebFrame()->document().manifestURL();
- if (url.is_empty()) {
+ if (manifest_url_.is_empty()) {
ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_EMPTY_URL);
ResolveCallbacks(ResolveStateFailure);
return;
}
- fetcher_.reset(new ManifestFetcher(url));
+ fetcher_.reset(new ManifestFetcher(manifest_url_));
fetcher_->Start(
render_frame()->GetWebFrame(),
render_frame()->GetWebFrame()->document().manifestUseCredentials(),
@@ -194,10 +187,14 @@ void ManifestManager::OnManifestFetchComplete(
}
void ManifestManager::ResolveCallbacks(ResolveState state) {
- if (state == ResolveStateFailure) {
- manifest_url_ = GURL();
+ // Do not reset |manifest_url_| on failure here. If manifest_url_ is
+ // non-empty, that means the link 404s, we failed to fetch it, or it was
+ // unparseable. However, the site still tried to specify a manifest, so
+ // preserve that information in the URL for the callbacks.
+ // |manifest_url| will be reset on navigation or if we receive a didchange
+ // event.
+ if (state == ResolveStateFailure)
manifest_ = Manifest();
- }
manifest_dirty_ = state != ResolveStateSuccess;
« no previous file with comments | « content/renderer/manifest/manifest_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698