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

Side by Side Diff: extensions/renderer/guest_view/extensions_guest_view_container.cc

Issue 892923002: Move GuestView IPCs into their own messages file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « extensions/extensions.gyp ('k') | extensions/renderer/guest_view/guest_view_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" 5 #include "extensions/renderer/guest_view/extensions_guest_view_container.h"
6 6
7 #include "content/public/renderer/render_frame.h" 7 #include "content/public/renderer/render_frame.h"
8 #include "content/public/renderer/render_view.h" 8 #include "content/public/renderer/render_view.h"
9 #include "extensions/common/extension_messages.h"
10 #include "extensions/common/guest_view/guest_view_constants.h" 9 #include "extensions/common/guest_view/guest_view_constants.h"
10 #include "extensions/common/guest_view/guest_view_messages.h"
11 #include "third_party/WebKit/public/web/WebLocalFrame.h" 11 #include "third_party/WebKit/public/web/WebLocalFrame.h"
12 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" 12 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
13 #include "third_party/WebKit/public/web/WebView.h" 13 #include "third_party/WebKit/public/web/WebView.h"
14 14
15 namespace { 15 namespace {
16 typedef std::map<int, extensions::ExtensionsGuestViewContainer*> 16 typedef std::map<int, extensions::ExtensionsGuestViewContainer*>
17 ExtensionsGuestViewContainerMap; 17 ExtensionsGuestViewContainerMap;
18 static base::LazyInstance<ExtensionsGuestViewContainerMap> 18 static base::LazyInstance<ExtensionsGuestViewContainerMap>
19 g_guest_view_container_map = LAZY_INSTANCE_INITIALIZER; 19 g_guest_view_container_map = LAZY_INSTANCE_INITIALIZER;
20 } // namespace 20 } // namespace
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 ExtensionsGuestViewContainer::AttachRequest::~AttachRequest() { 56 ExtensionsGuestViewContainer::AttachRequest::~AttachRequest() {
57 } 57 }
58 58
59 void ExtensionsGuestViewContainer::AttachRequest::PerformRequest() { 59 void ExtensionsGuestViewContainer::AttachRequest::PerformRequest() {
60 if (!container()->render_frame()) 60 if (!container()->render_frame())
61 return; 61 return;
62 62
63 // Step 1, send the attach params to extensions/. 63 // Step 1, send the attach params to extensions/.
64 container()->render_frame()->Send( 64 container()->render_frame()->Send(
65 new ExtensionHostMsg_AttachGuest(container()->render_view_routing_id(), 65 new GuestViewHostMsg_AttachGuest(container()->render_view_routing_id(),
66 container()->element_instance_id(), 66 container()->element_instance_id(),
67 guest_instance_id_, 67 guest_instance_id_,
68 *params_)); 68 *params_));
69 69
70 // Step 2, attach plugin through content/. 70 // Step 2, attach plugin through content/.
71 container()->render_frame()->AttachGuest(container()->element_instance_id()); 71 container()->render_frame()->AttachGuest(container()->element_instance_id());
72 } 72 }
73 73
74 void ExtensionsGuestViewContainer::AttachRequest::HandleResponse( 74 void ExtensionsGuestViewContainer::AttachRequest::HandleResponse(
75 const IPC::Message& message) { 75 const IPC::Message& message) {
76 ExtensionMsg_GuestAttached::Param param; 76 GuestViewMsg_GuestAttached::Param param;
77 if (!ExtensionMsg_GuestAttached::Read(&message, &param)) 77 if (!GuestViewMsg_GuestAttached::Read(&message, &param))
78 return; 78 return;
79 79
80 // If we don't have a callback then there's nothing more to do. 80 // If we don't have a callback then there's nothing more to do.
81 if (!HasCallback()) 81 if (!HasCallback())
82 return; 82 return;
83 83
84 content::RenderView* guest_proxy_render_view = 84 content::RenderView* guest_proxy_render_view =
85 content::RenderView::FromRoutingID(get<1>(param)); 85 content::RenderView::FromRoutingID(get<1>(param));
86 // TODO(fsamuel): Should we be reporting an error to JavaScript or DCHECKing? 86 // TODO(fsamuel): Should we be reporting an error to JavaScript or DCHECKing?
87 if (!guest_proxy_render_view) 87 if (!guest_proxy_render_view)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 250
251 void ExtensionsGuestViewContainer::HandlePendingResponseCallback( 251 void ExtensionsGuestViewContainer::HandlePendingResponseCallback(
252 const IPC::Message& message) { 252 const IPC::Message& message) {
253 CHECK(pending_response_.get()); 253 CHECK(pending_response_.get());
254 linked_ptr<Request> pending_response(pending_response_.release()); 254 linked_ptr<Request> pending_response(pending_response_.release());
255 pending_response->HandleResponse(message); 255 pending_response->HandleResponse(message);
256 } 256 }
257 257
258 } // namespace extensions 258 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/extensions.gyp ('k') | extensions/renderer/guest_view/guest_view_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698