| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 auto guest_view_container = | 140 auto guest_view_container = |
| 141 guest_view::GuestViewContainer::FromID(element_instance_id); | 141 guest_view::GuestViewContainer::FromID(element_instance_id); |
| 142 | 142 |
| 143 // TODO(fsamuel): Should we be reporting an error if the element instance ID | 143 // TODO(fsamuel): Should we be reporting an error if the element instance ID |
| 144 // is invalid? | 144 // is invalid? |
| 145 if (!guest_view_container) | 145 if (!guest_view_container) |
| 146 return; | 146 return; |
| 147 | 147 |
| 148 int guest_instance_id = args[1]->Int32Value(); | 148 int guest_instance_id = args[1]->Int32Value(); |
| 149 | 149 |
| 150 scoped_ptr<base::DictionaryValue> params; | 150 std::unique_ptr<base::DictionaryValue> params; |
| 151 { | 151 { |
| 152 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 152 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 153 scoped_ptr<base::Value> params_as_value( | 153 std::unique_ptr<base::Value> params_as_value( |
| 154 converter->FromV8Value(args[2], context()->v8_context())); | 154 converter->FromV8Value(args[2], context()->v8_context())); |
| 155 params = base::DictionaryValue::From(std::move(params_as_value)); | 155 params = base::DictionaryValue::From(std::move(params_as_value)); |
| 156 CHECK(params); | 156 CHECK(params); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Add flag to |params| to indicate that the element size is specified in | 159 // Add flag to |params| to indicate that the element size is specified in |
| 160 // logical units. | 160 // logical units. |
| 161 params->SetBoolean(guest_view::kElementSizeIsLogical, true); | 161 params->SetBoolean(guest_view::kElementSizeIsLogical, true); |
| 162 | 162 |
| 163 linked_ptr<guest_view::GuestViewRequest> request( | 163 linked_ptr<guest_view::GuestViewRequest> request( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 CHECK(args[2]->IsObject()); | 214 CHECK(args[2]->IsObject()); |
| 215 // <iframe>.contentWindow. | 215 // <iframe>.contentWindow. |
| 216 CHECK(args[3]->IsObject()); | 216 CHECK(args[3]->IsObject()); |
| 217 // Optional Callback Function. | 217 // Optional Callback Function. |
| 218 CHECK(args.Length() <= num_required_params || | 218 CHECK(args.Length() <= num_required_params || |
| 219 args[num_required_params]->IsFunction()); | 219 args[num_required_params]->IsFunction()); |
| 220 | 220 |
| 221 int element_instance_id = args[0]->Int32Value(); | 221 int element_instance_id = args[0]->Int32Value(); |
| 222 int guest_instance_id = args[1]->Int32Value(); | 222 int guest_instance_id = args[1]->Int32Value(); |
| 223 | 223 |
| 224 scoped_ptr<base::DictionaryValue> params; | 224 std::unique_ptr<base::DictionaryValue> params; |
| 225 { | 225 { |
| 226 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 226 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 227 scoped_ptr<base::Value> params_as_value( | 227 std::unique_ptr<base::Value> params_as_value( |
| 228 converter->FromV8Value(args[2], context()->v8_context())); | 228 converter->FromV8Value(args[2], context()->v8_context())); |
| 229 params = base::DictionaryValue::From(std::move(params_as_value)); | 229 params = base::DictionaryValue::From(std::move(params_as_value)); |
| 230 CHECK(params); | 230 CHECK(params); |
| 231 } | 231 } |
| 232 | 232 |
| 233 // Add flag to |params| to indicate that the element size is specified in | 233 // Add flag to |params| to indicate that the element size is specified in |
| 234 // logical units. | 234 // logical units. |
| 235 params->SetBoolean(guest_view::kElementSizeIsLogical, true); | 235 params->SetBoolean(guest_view::kElementSizeIsLogical, true); |
| 236 | 236 |
| 237 content::RenderFrame* render_frame = GetRenderFrame(args[3]); | 237 content::RenderFrame* render_frame = GetRenderFrame(args[3]); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 const v8::FunctionCallbackInfo<v8::Value>& args) { | 429 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 430 // Gesture is required to request fullscreen. | 430 // Gesture is required to request fullscreen. |
| 431 blink::WebScopedUserGesture user_gesture; | 431 blink::WebScopedUserGesture user_gesture; |
| 432 CHECK_EQ(args.Length(), 1); | 432 CHECK_EQ(args.Length(), 1); |
| 433 CHECK(args[0]->IsFunction()); | 433 CHECK(args[0]->IsFunction()); |
| 434 v8::Local<v8::Value> no_args; | 434 v8::Local<v8::Value> no_args; |
| 435 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); | 435 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); |
| 436 } | 436 } |
| 437 | 437 |
| 438 } // namespace extensions | 438 } // namespace extensions |
| OLD | NEW |