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/guest_view_internal_custom_bindings.h" | 5 #include "extensions/renderer/guest_view/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 "content/public/child/v8_value_converter.h" | 10 #include "content/public/child/v8_value_converter.h" |
11 #include "content/public/renderer/render_view.h" | 11 #include "content/public/renderer/render_view.h" |
12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
13 #include "extensions/common/extension_messages.h" | 13 #include "extensions/common/extension_messages.h" |
| 14 #include "extensions/common/guest_view/guest_view_constants.h" |
14 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" | 15 #include "extensions/renderer/guest_view/extensions_guest_view_container.h" |
15 #include "extensions/renderer/script_context.h" | 16 #include "extensions/renderer/script_context.h" |
16 #include "v8/include/v8.h" | 17 #include "v8/include/v8.h" |
17 | 18 |
18 using content::V8ValueConverter; | 19 using content::V8ValueConverter; |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 | 22 |
22 GuestViewInternalCustomBindings::GuestViewInternalCustomBindings( | 23 GuestViewInternalCustomBindings::GuestViewInternalCustomBindings( |
23 ScriptContext* context) | 24 ScriptContext* context) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 scoped_ptr<base::DictionaryValue> params; | 68 scoped_ptr<base::DictionaryValue> params; |
68 { | 69 { |
69 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 70 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
70 scoped_ptr<base::Value> params_as_value( | 71 scoped_ptr<base::Value> params_as_value( |
71 converter->FromV8Value(args[2], context()->v8_context())); | 72 converter->FromV8Value(args[2], context()->v8_context())); |
72 CHECK(params_as_value->IsType(base::Value::TYPE_DICTIONARY)); | 73 CHECK(params_as_value->IsType(base::Value::TYPE_DICTIONARY)); |
73 params.reset( | 74 params.reset( |
74 static_cast<base::DictionaryValue*>(params_as_value.release())); | 75 static_cast<base::DictionaryValue*>(params_as_value.release())); |
75 } | 76 } |
76 | 77 |
| 78 // Add flag to |params| to indicate that the element size is specified in |
| 79 // logical units. |
| 80 params->SetBoolean(guestview::kElementSizeIsLogical, true); |
| 81 |
77 linked_ptr<ExtensionsGuestViewContainer::Request> request( | 82 linked_ptr<ExtensionsGuestViewContainer::Request> request( |
78 new ExtensionsGuestViewContainer::AttachRequest( | 83 new ExtensionsGuestViewContainer::AttachRequest( |
79 guest_view_container, | 84 guest_view_container, |
80 guest_instance_id, | 85 guest_instance_id, |
81 params.Pass(), | 86 params.Pass(), |
82 args.Length() == 4 ? args[3].As<v8::Function>() : | 87 args.Length() == 4 ? args[3].As<v8::Function>() : |
83 v8::Handle<v8::Function>(), | 88 v8::Handle<v8::Function>(), |
84 args.GetIsolate())); | 89 args.GetIsolate())); |
85 guest_view_container->IssueRequest(request); | 90 guest_view_container->IssueRequest(request); |
86 | 91 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (!guest_view_container) | 162 if (!guest_view_container) |
158 return; | 163 return; |
159 | 164 |
160 guest_view_container->RegisterElementResizeCallback( | 165 guest_view_container->RegisterElementResizeCallback( |
161 args[1].As<v8::Function>(), args.GetIsolate()); | 166 args[1].As<v8::Function>(), args.GetIsolate()); |
162 | 167 |
163 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true)); | 168 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true)); |
164 } | 169 } |
165 | 170 |
166 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |