| 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 "chrome/renderer/extensions/guest_view_internal_custom_bindings.h" | 5 #include "extensions/renderer/guest_view_internal_custom_bindings.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/common/extensions/chrome_extension_messages.h" | |
| 11 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
| 12 #include "content/public/renderer/render_view.h" | 11 #include "content/public/renderer/render_view.h" |
| 13 #include "content/public/renderer/v8_value_converter.h" | 12 #include "content/public/renderer/v8_value_converter.h" |
| 14 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 14 #include "extensions/common/extension_messages.h" |
| 15 #include "extensions/renderer/script_context.h" | 15 #include "extensions/renderer/script_context.h" |
| 16 #include "v8/include/v8.h" | 16 #include "v8/include/v8.h" |
| 17 | 17 |
| 18 using content::V8ValueConverter; | 18 using content::V8ValueConverter; |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 GuestViewInternalCustomBindings::GuestViewInternalCustomBindings( | 22 GuestViewInternalCustomBindings::GuestViewInternalCustomBindings( |
| 23 ScriptContext* context) | 23 ScriptContext* context) |
| 24 : ObjectBackedNativeHandler(context) { | 24 : ObjectBackedNativeHandler(context) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 { | 43 { |
| 44 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 44 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 45 scoped_ptr<base::Value> params_as_value( | 45 scoped_ptr<base::Value> params_as_value( |
| 46 converter->FromV8Value(args[2], context()->v8_context())); | 46 converter->FromV8Value(args[2], context()->v8_context())); |
| 47 CHECK(params_as_value->IsType(base::Value::TYPE_DICTIONARY)); | 47 CHECK(params_as_value->IsType(base::Value::TYPE_DICTIONARY)); |
| 48 params.reset( | 48 params.reset( |
| 49 static_cast<base::DictionaryValue*>(params_as_value.release())); | 49 static_cast<base::DictionaryValue*>(params_as_value.release())); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Step 1, send the attach params to chrome/. | 52 // Step 1, send the attach params to chrome/. |
| 53 render_frame->Send(new ChromeExtensionHostMsg_AttachGuest( | 53 render_frame->Send(new ExtensionHostMsg_AttachGuest( |
| 54 render_frame->GetRenderView()->GetRoutingID(), | 54 render_frame->GetRenderView()->GetRoutingID(), |
| 55 element_instance_id, | 55 element_instance_id, |
| 56 guest_instance_id, | 56 guest_instance_id, |
| 57 *params)); | 57 *params)); |
| 58 | 58 |
| 59 // Step 2, attach plugin through content/. | 59 // Step 2, attach plugin through content/. |
| 60 render_frame->AttachGuest(element_instance_id); | 60 render_frame->AttachGuest(element_instance_id); |
| 61 | 61 |
| 62 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true)); | 62 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace extensions | 65 } // namespace extensions |
| OLD | NEW |