OLD | NEW |
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 "components/guest_view/common/guest_view_constants.h" |
| 11 #include "components/guest_view/common/guest_view_messages.h" |
10 #include "content/public/child/v8_value_converter.h" | 12 #include "content/public/child/v8_value_converter.h" |
11 #include "content/public/renderer/render_frame.h" | 13 #include "content/public/renderer/render_frame.h" |
12 #include "content/public/renderer/render_view.h" | 14 #include "content/public/renderer/render_view.h" |
13 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons
tants.h" | 15 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons
tants.h" |
14 #include "extensions/common/extension_messages.h" | 16 #include "extensions/common/extension_messages.h" |
15 #include "extensions/common/guest_view/extensions_guest_view_messages.h" | 17 #include "extensions/common/guest_view/extensions_guest_view_messages.h" |
16 #include "extensions/common/guest_view/guest_view_constants.h" | |
17 #include "extensions/common/guest_view/guest_view_messages.h" | |
18 #include "gin/arguments.h" | 18 #include "gin/arguments.h" |
19 #include "gin/dictionary.h" | 19 #include "gin/dictionary.h" |
20 #include "gin/handle.h" | 20 #include "gin/handle.h" |
21 #include "gin/interceptor.h" | 21 #include "gin/interceptor.h" |
22 #include "gin/object_template_builder.h" | 22 #include "gin/object_template_builder.h" |
23 #include "gin/wrappable.h" | 23 #include "gin/wrappable.h" |
24 #include "third_party/WebKit/public/web/WebDocument.h" | 24 #include "third_party/WebKit/public/web/WebDocument.h" |
25 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 25 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
26 #include "third_party/WebKit/public/web/WebView.h" | 26 #include "third_party/WebKit/public/web/WebView.h" |
27 | 27 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 v8::HandleScope handle_scope(isolate); | 257 v8::HandleScope handle_scope(isolate); |
258 v8::Context::Scope context_scope(frame->mainWorldScriptContext()); | 258 v8::Context::Scope context_scope(frame->mainWorldScriptContext()); |
259 scoped_ptr<content::V8ValueConverter> converter( | 259 scoped_ptr<content::V8ValueConverter> converter( |
260 content::V8ValueConverter::create()); | 260 content::V8ValueConverter::create()); |
261 PostMessage(isolate, | 261 PostMessage(isolate, |
262 converter->ToV8Value(&message, frame->mainWorldScriptContext())); | 262 converter->ToV8Value(&message, frame->mainWorldScriptContext())); |
263 } | 263 } |
264 | 264 |
265 void MimeHandlerViewContainer::OnCreateMimeHandlerViewGuestACK( | 265 void MimeHandlerViewContainer::OnCreateMimeHandlerViewGuestACK( |
266 int element_instance_id) { | 266 int element_instance_id) { |
267 DCHECK_NE(this->element_instance_id(), guestview::kInstanceIDNone); | 267 DCHECK_NE(this->element_instance_id(), guest_view::kInstanceIDNone); |
268 DCHECK_EQ(this->element_instance_id(), element_instance_id); | 268 DCHECK_EQ(this->element_instance_id(), element_instance_id); |
269 | 269 |
270 if (!render_frame()) | 270 if (!render_frame()) |
271 return; | 271 return; |
272 | 272 |
273 render_frame()->AttachGuest(element_instance_id); | 273 render_frame()->AttachGuest(element_instance_id); |
274 } | 274 } |
275 | 275 |
276 void MimeHandlerViewContainer::OnGuestAttached(int /* unused */, | 276 void MimeHandlerViewContainer::OnGuestAttached(int /* unused */, |
277 int guest_proxy_routing_id) { | 277 int guest_proxy_routing_id) { |
(...skipping 22 matching lines...) Expand all Loading... |
300 for (const auto& pending_message : pending_messages_) | 300 for (const auto& pending_message : pending_messages_) |
301 PostMessage(isolate, v8::Local<v8::Value>::New(isolate, *pending_message)); | 301 PostMessage(isolate, v8::Local<v8::Value>::New(isolate, *pending_message)); |
302 | 302 |
303 pending_messages_.clear(); | 303 pending_messages_.clear(); |
304 } | 304 } |
305 | 305 |
306 void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() { | 306 void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() { |
307 // The loader has completed loading |view_id_| so we can dispose it. | 307 // The loader has completed loading |view_id_| so we can dispose it. |
308 loader_.reset(); | 308 loader_.reset(); |
309 | 309 |
310 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone); | 310 DCHECK_NE(element_instance_id(), guest_view::kInstanceIDNone); |
311 | 311 |
312 if (!render_frame()) | 312 if (!render_frame()) |
313 return; | 313 return; |
314 | 314 |
315 render_frame()->Send( | 315 render_frame()->Send( |
316 new ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest( | 316 new ExtensionsGuestViewHostMsg_CreateMimeHandlerViewGuest( |
317 render_frame()->GetRoutingID(), view_id_, element_instance_id(), | 317 render_frame()->GetRoutingID(), view_id_, element_instance_id(), |
318 element_size_)); | 318 element_size_)); |
319 } | 319 } |
320 | 320 |
321 } // namespace extensions | 321 } // namespace extensions |
OLD | NEW |