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

Side by Side Diff: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc

Issue 1092853002: GuestView: Decouple extension IPCs from soon-to-be component IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_guest_view_registry_to_guest_view_manager
Patch Set: Updated Created 5 years, 8 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
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/mime_handler_view/mime_handler_view_con tainer.h" 5 #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "content/public/child/v8_value_converter.h" 10 #include "content/public/child/v8_value_converter.h"
11 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons tants.h" 13 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons tants.h"
14 #include "extensions/common/extension_messages.h" 14 #include "extensions/common/extension_messages.h"
15 #include "extensions/common/guest_view/extensions_guest_view_messages.h"
15 #include "extensions/common/guest_view/guest_view_constants.h" 16 #include "extensions/common/guest_view/guest_view_constants.h"
16 #include "extensions/common/guest_view/guest_view_messages.h" 17 #include "extensions/common/guest_view/guest_view_messages.h"
17 #include "gin/arguments.h" 18 #include "gin/arguments.h"
18 #include "gin/dictionary.h" 19 #include "gin/dictionary.h"
19 #include "gin/handle.h" 20 #include "gin/handle.h"
20 #include "gin/interceptor.h" 21 #include "gin/interceptor.h"
21 #include "gin/object_template_builder.h" 22 #include "gin/object_template_builder.h"
22 #include "gin/wrappable.h" 23 #include "gin/wrappable.h"
23 #include "third_party/WebKit/public/web/WebDocument.h" 24 #include "third_party/WebKit/public/web/WebDocument.h"
24 #include "third_party/WebKit/public/web/WebLocalFrame.h" 25 #include "third_party/WebKit/public/web/WebLocalFrame.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 158 }
158 159
159 void MimeHandlerViewContainer::DidReceiveData(const char* data, 160 void MimeHandlerViewContainer::DidReceiveData(const char* data,
160 int data_length) { 161 int data_length) {
161 view_id_ += std::string(data, data_length); 162 view_id_ += std::string(data, data_length);
162 } 163 }
163 164
164 bool MimeHandlerViewContainer::OnMessageReceived(const IPC::Message& message) { 165 bool MimeHandlerViewContainer::OnMessageReceived(const IPC::Message& message) {
165 bool handled = true; 166 bool handled = true;
166 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewContainer, message) 167 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewContainer, message)
167 IPC_MESSAGE_HANDLER(GuestViewMsg_CreateMimeHandlerViewGuestACK, 168 IPC_MESSAGE_HANDLER(ExtensionsGuestViewMsg_CreateMimeHandlerViewGuestACK,
168 OnCreateMimeHandlerViewGuestACK) 169 OnCreateMimeHandlerViewGuestACK)
170 IPC_MESSAGE_HANDLER(
171 ExtensionsGuestViewMsg_MimeHandlerViewGuestOnLoadCompleted,
172 OnMimeHandlerViewGuestOnLoadCompleted)
169 IPC_MESSAGE_HANDLER(GuestViewMsg_GuestAttached, OnGuestAttached) 173 IPC_MESSAGE_HANDLER(GuestViewMsg_GuestAttached, OnGuestAttached)
170 IPC_MESSAGE_HANDLER(GuestViewMsg_MimeHandlerViewGuestOnLoadCompleted,
171 OnMimeHandlerViewGuestOnLoadCompleted)
172 IPC_MESSAGE_UNHANDLED(handled = false) 174 IPC_MESSAGE_UNHANDLED(handled = false)
173 IPC_END_MESSAGE_MAP() 175 IPC_END_MESSAGE_MAP()
174 return handled; 176 return handled;
175 } 177 }
176 178
177 void MimeHandlerViewContainer::DidResizeElement(const gfx::Size& old_size, 179 void MimeHandlerViewContainer::DidResizeElement(const gfx::Size& old_size,
178 const gfx::Size& new_size) { 180 const gfx::Size& new_size) {
179 element_size_ = new_size; 181 element_size_ = new_size;
180 render_frame()->Send(new GuestViewHostMsg_ResizeGuest( 182 render_frame()->Send(new ExtensionsGuestViewHostMsg_ResizeGuest(
181 render_frame()->GetRoutingID(), element_instance_id(), new_size)); 183 render_frame()->GetRoutingID(), element_instance_id(), new_size));
182 } 184 }
183 185
184 v8::Local<v8::Object> MimeHandlerViewContainer::V8ScriptableObject( 186 v8::Local<v8::Object> MimeHandlerViewContainer::V8ScriptableObject(
185 v8::Isolate* isolate) { 187 v8::Isolate* isolate) {
186 if (scriptable_object_.IsEmpty()) { 188 if (scriptable_object_.IsEmpty()) {
187 v8::Local<v8::Object> object = 189 v8::Local<v8::Object> object =
188 ScriptableObject::Create(isolate, weak_factory_.GetWeakPtr()); 190 ScriptableObject::Create(isolate, weak_factory_.GetWeakPtr());
189 scriptable_object_.Reset(isolate, object); 191 scriptable_object_.Reset(isolate, object);
190 } 192 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 310
309 void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() { 311 void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() {
310 // The loader has completed loading |view_id_| so we can dispose it. 312 // The loader has completed loading |view_id_| so we can dispose it.
311 loader_.reset(); 313 loader_.reset();
312 314
313 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone); 315 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone);
314 316
315 if (!render_frame()) 317 if (!render_frame())
316 return; 318 return;
317 319
318 render_frame()->Send(new GuestViewHostMsg_CreateMimeHandlerViewGuest( 320 render_frame()->Send(
319 render_frame()->GetRoutingID(), view_id_, element_instance_id(), 321 new ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest(
320 element_size_)); 322 render_frame()->GetRoutingID(), view_id_, element_instance_id(),
323 element_size_));
321 } 324 }
322 325
323 } // namespace extensions 326 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698