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

Unified Diff: content/browser/manifest/manifest_manager_host.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/browser/manifest/manifest_manager_host.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/manifest/manifest_manager_host.cc
diff --git a/content/browser/manifest/manifest_manager_host.cc b/content/browser/manifest/manifest_manager_host.cc
index 112c3344c7a49bac205b83d508138fb1036bf652..ea6557fa4e06f31faaf798462c6ea2973bc3644f 100644
--- a/content/browser/manifest/manifest_manager_host.cc
+++ b/content/browser/manifest/manifest_manager_host.cc
@@ -34,7 +34,6 @@ ManifestManagerHost::ManifestManagerHost(WebContents* web_contents)
ManifestManagerHost::~ManifestManagerHost() {
STLDeleteValues(&pending_get_callbacks_);
- STLDeleteValues(&pending_has_callbacks_);
}
ManifestManagerHost::GetCallbackMap*
@@ -45,49 +44,22 @@ ManifestManagerHost::GetCallbackMapForFrame(
return it != pending_get_callbacks_.end() ? it->second : nullptr;
}
-ManifestManagerHost::HasCallbackMap*
-ManifestManagerHost::HasCallbackMapForFrame(
- RenderFrameHost* render_frame_host) {
- FrameHasCallbackMap::iterator it =
- pending_has_callbacks_.find(render_frame_host);
- return it != pending_has_callbacks_.end() ? it->second : nullptr;
-}
-
void ManifestManagerHost::RenderFrameDeleted(
RenderFrameHost* render_frame_host) {
- {
- GetCallbackMap* callbacks = GetCallbackMapForFrame(render_frame_host);
- if (!callbacks)
- return;
-
- // Call the callbacks with a failure state before deleting them. Do this in
- // a block so the iterator is destroyed before |callbacks|.
- {
- GetCallbackMap::const_iterator it(callbacks);
- for (; !it.IsAtEnd(); it.Advance())
- it.GetCurrentValue()->Run(GURL(), Manifest());
- }
-
- delete callbacks;
- pending_get_callbacks_.erase(render_frame_host);
- }
+ GetCallbackMap* callbacks = GetCallbackMapForFrame(render_frame_host);
+ if (!callbacks)
+ return;
+ // Call the callbacks with a failure state before deleting them. Do this in
+ // a block so the iterator is destroyed before |callbacks|.
{
- HasCallbackMap* callbacks = HasCallbackMapForFrame(render_frame_host);
- if (!callbacks)
- return;
-
- // Call the callbacks with a failure state before deleting them. Do this in
- // a block so the iterator is destroyed before |callbacks|.
- {
- HasCallbackMap::const_iterator it(callbacks);
- for (; !it.IsAtEnd(); it.Advance())
- it.GetCurrentValue()->Run(false);
- }
-
- delete callbacks;
- pending_has_callbacks_.erase(render_frame_host);
+ GetCallbackMap::const_iterator it(callbacks);
+ for (; !it.IsAtEnd(); it.Advance())
+ it.GetCurrentValue()->Run(GURL(), Manifest());
}
+
+ delete callbacks;
+ pending_get_callbacks_.erase(render_frame_host);
}
void ManifestManagerHost::GetManifest(RenderFrameHost* render_frame_host,
@@ -104,20 +76,6 @@ void ManifestManagerHost::GetManifest(RenderFrameHost* render_frame_host,
render_frame_host->GetRoutingID(), request_id));
}
-void ManifestManagerHost::HasManifest(RenderFrameHost* render_frame_host,
- const HasManifestCallback& callback) {
- HasCallbackMap* callbacks = HasCallbackMapForFrame(render_frame_host);
- if (!callbacks) {
- callbacks = new HasCallbackMap();
- pending_has_callbacks_[render_frame_host] = callbacks;
- }
-
- int request_id = callbacks->Add(new HasManifestCallback(callback));
-
- render_frame_host->Send(new ManifestManagerMsg_HasManifest(
- render_frame_host->GetRoutingID(), request_id));
-}
-
bool ManifestManagerHost::OnMessageReceived(
const IPC::Message& message, RenderFrameHost* render_frame_host) {
bool handled = true;
@@ -126,8 +84,6 @@ bool ManifestManagerHost::OnMessageReceived(
render_frame_host)
IPC_MESSAGE_HANDLER(ManifestManagerHostMsg_RequestManifestResponse,
OnRequestManifestResponse)
- IPC_MESSAGE_HANDLER(ManifestManagerHostMsg_HasManifestResponse,
- OnHasManifestResponse)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -203,32 +159,4 @@ void ManifestManagerHost::OnRequestManifestResponse(
}
}
-void ManifestManagerHost::OnHasManifestResponse(
- RenderFrameHost* render_frame_host,
- int request_id,
- bool has_manifest) {
- HasCallbackMap* callbacks = HasCallbackMapForFrame(render_frame_host);
- if (!callbacks) {
- DVLOG(1) << "Unexpected HasManifestResponse from renderer. "
- "Killing renderer.";
- KillRenderer(render_frame_host);
- return;
- }
-
- HasManifestCallback* callback = callbacks->Lookup(request_id);
- if (!callback) {
- DVLOG(1) << "Received a request_id (" << request_id << ") from renderer "
- "with no associated callback. Killing renderer.";
- KillRenderer(render_frame_host);
- return;
- }
-
- callback->Run(has_manifest);
- callbacks->Remove(request_id);
- if (callbacks->IsEmpty()) {
- delete callbacks;
- pending_has_callbacks_.erase(render_frame_host);
- }
-}
-
} // namespace content
« no previous file with comments | « content/browser/manifest/manifest_manager_host.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698