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/messaging_bindings.h" | 5 #include "extensions/renderer/messaging_bindings.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 int target_port_id, | 281 int target_port_id, |
282 const std::string& channel_name, | 282 const std::string& channel_name, |
283 const ExtensionMsg_TabConnectionInfo* source, | 283 const ExtensionMsg_TabConnectionInfo* source, |
284 const ExtensionMsg_ExternalConnectionInfo& info, | 284 const ExtensionMsg_ExternalConnectionInfo& info, |
285 const std::string& tls_channel_id, | 285 const std::string& tls_channel_id, |
286 bool* port_created, | 286 bool* port_created, |
287 ScriptContext* script_context) { | 287 ScriptContext* script_context) { |
288 v8::Isolate* isolate = script_context->isolate(); | 288 v8::Isolate* isolate = script_context->isolate(); |
289 v8::HandleScope handle_scope(isolate); | 289 v8::HandleScope handle_scope(isolate); |
290 | 290 |
291 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 291 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
292 | 292 |
293 const std::string& source_url_spec = info.source_url.spec(); | 293 const std::string& source_url_spec = info.source_url.spec(); |
294 std::string target_extension_id = script_context->GetExtensionID(); | 294 std::string target_extension_id = script_context->GetExtensionID(); |
295 const Extension* extension = script_context->extension(); | 295 const Extension* extension = script_context->extension(); |
296 | 296 |
297 v8::Local<v8::Value> tab = v8::Null(isolate); | 297 v8::Local<v8::Value> tab = v8::Null(isolate); |
298 v8::Local<v8::Value> tls_channel_id_value = v8::Undefined(isolate); | 298 v8::Local<v8::Value> tls_channel_id_value = v8::Undefined(isolate); |
299 v8::Local<v8::Value> guest_process_id = v8::Undefined(isolate); | 299 v8::Local<v8::Value> guest_process_id = v8::Undefined(isolate); |
300 v8::Local<v8::Value> guest_render_frame_routing_id = v8::Undefined(isolate); | 300 v8::Local<v8::Value> guest_render_frame_routing_id = v8::Undefined(isolate); |
301 | 301 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if (!has_port.As<v8::Boolean>()->Value()) | 388 if (!has_port.As<v8::Boolean>()->Value()) |
389 return; | 389 return; |
390 | 390 |
391 v8::Local<v8::String> v8_data; | 391 v8::Local<v8::String> v8_data; |
392 if (!ToV8String(isolate, message.data.c_str(), &v8_data)) | 392 if (!ToV8String(isolate, message.data.c_str(), &v8_data)) |
393 return; | 393 return; |
394 std::vector<v8::Local<v8::Value>> arguments; | 394 std::vector<v8::Local<v8::Value>> arguments; |
395 arguments.push_back(v8_data); | 395 arguments.push_back(v8_data); |
396 arguments.push_back(port_id_handle); | 396 arguments.push_back(port_id_handle); |
397 | 397 |
398 scoped_ptr<blink::WebScopedUserGesture> web_user_gesture; | 398 std::unique_ptr<blink::WebScopedUserGesture> web_user_gesture; |
399 scoped_ptr<blink::WebScopedWindowFocusAllowedIndicator> allow_window_focus; | 399 std::unique_ptr<blink::WebScopedWindowFocusAllowedIndicator> |
| 400 allow_window_focus; |
400 if (message.user_gesture) { | 401 if (message.user_gesture) { |
401 web_user_gesture.reset(new blink::WebScopedUserGesture); | 402 web_user_gesture.reset(new blink::WebScopedUserGesture); |
402 | 403 |
403 if (script_context->web_frame()) { | 404 if (script_context->web_frame()) { |
404 blink::WebDocument document = script_context->web_frame()->document(); | 405 blink::WebDocument document = script_context->web_frame()->document(); |
405 allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator( | 406 allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator( |
406 &document)); | 407 &document)); |
407 } | 408 } |
408 } | 409 } |
409 | 410 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 const ScriptContextSet& context_set, | 483 const ScriptContextSet& context_set, |
483 int port_id, | 484 int port_id, |
484 const std::string& error_message, | 485 const std::string& error_message, |
485 content::RenderFrame* restrict_to_render_frame) { | 486 content::RenderFrame* restrict_to_render_frame) { |
486 context_set.ForEach( | 487 context_set.ForEach( |
487 restrict_to_render_frame, | 488 restrict_to_render_frame, |
488 base::Bind(&DispatchOnDisconnectToScriptContext, port_id, error_message)); | 489 base::Bind(&DispatchOnDisconnectToScriptContext, port_id, error_message)); |
489 } | 490 } |
490 | 491 |
491 } // namespace extensions | 492 } // namespace extensions |
OLD | NEW |