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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (!ToV8String(isolate, message.data.c_str(), &v8_data)) | 196 if (!ToV8String(isolate, message.data.c_str(), &v8_data)) |
197 return; | 197 return; |
198 std::vector<v8::Local<v8::Value>> arguments; | 198 std::vector<v8::Local<v8::Value>> arguments; |
199 arguments.push_back(v8_data); | 199 arguments.push_back(v8_data); |
200 arguments.push_back(port_id_handle); | 200 arguments.push_back(port_id_handle); |
201 | 201 |
202 std::unique_ptr<blink::WebScopedUserGesture> web_user_gesture; | 202 std::unique_ptr<blink::WebScopedUserGesture> web_user_gesture; |
203 std::unique_ptr<blink::WebScopedWindowFocusAllowedIndicator> | 203 std::unique_ptr<blink::WebScopedWindowFocusAllowedIndicator> |
204 allow_window_focus; | 204 allow_window_focus; |
205 if (message.user_gesture) { | 205 if (message.user_gesture) { |
206 web_user_gesture.reset(new blink::WebScopedUserGesture); | 206 web_user_gesture.reset( |
| 207 new blink::WebScopedUserGesture(script_context->web_frame())); |
207 | 208 |
208 if (script_context->web_frame()) { | 209 if (script_context->web_frame()) { |
209 blink::WebDocument document = script_context->web_frame()->document(); | 210 blink::WebDocument document = script_context->web_frame()->document(); |
210 allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator( | 211 allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator( |
211 &document)); | 212 &document)); |
212 } | 213 } |
213 } | 214 } |
214 | 215 |
215 script_context->module_system()->CallModuleMethodSafe( | 216 script_context->module_system()->CallModuleMethodSafe( |
216 "messaging", "dispatchOnMessage", &arguments); | 217 "messaging", "dispatchOnMessage", &arguments); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 DCHECK(iter != disconnected_ports_.end()); | 553 DCHECK(iter != disconnected_ports_.end()); |
553 iter->second->SetGlobalId(global_id); | 554 iter->second->SetGlobalId(global_id); |
554 // Setting the global id dispatches pending messages, so we can delete the | 555 // Setting the global id dispatches pending messages, so we can delete the |
555 // port now. | 556 // port now. |
556 disconnected_ports_.erase(iter); | 557 disconnected_ports_.erase(iter); |
557 } | 558 } |
558 | 559 |
559 int MessagingBindings::GetNextLocalId() { return next_local_id_++; } | 560 int MessagingBindings::GetNextLocalId() { return next_local_id_++; } |
560 | 561 |
561 } // namespace extensions | 562 } // namespace extensions |
OLD | NEW |