Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: extensions/renderer/messaging_bindings.cc

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: a Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (!ToV8String(isolate, message.data.c_str(), &v8_data)) 197 if (!ToV8String(isolate, message.data.c_str(), &v8_data))
198 return; 198 return;
199 std::vector<v8::Local<v8::Value>> arguments; 199 std::vector<v8::Local<v8::Value>> arguments;
200 arguments.push_back(v8_data); 200 arguments.push_back(v8_data);
201 arguments.push_back(port_id_handle); 201 arguments.push_back(port_id_handle);
202 202
203 std::unique_ptr<blink::WebScopedUserGesture> web_user_gesture; 203 std::unique_ptr<blink::WebScopedUserGesture> web_user_gesture;
204 std::unique_ptr<blink::WebScopedWindowFocusAllowedIndicator> 204 std::unique_ptr<blink::WebScopedWindowFocusAllowedIndicator>
205 allow_window_focus; 205 allow_window_focus;
206 if (message.user_gesture) { 206 if (message.user_gesture) {
207 web_user_gesture.reset(new blink::WebScopedUserGesture); 207 web_user_gesture.reset(
208 new blink::WebScopedUserGesture(script_context->web_frame()));
208 209
209 if (script_context->web_frame()) { 210 if (script_context->web_frame()) {
210 blink::WebDocument document = script_context->web_frame()->document(); 211 blink::WebDocument document = script_context->web_frame()->document();
211 allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator( 212 allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator(
212 &document)); 213 &document));
213 } 214 }
214 } 215 }
215 216
216 script_context->module_system()->CallModuleMethod( 217 script_context->module_system()->CallModuleMethod(
217 "messaging", "dispatchOnMessage", &arguments); 218 "messaging", "dispatchOnMessage", &arguments);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 DCHECK(iter != disconnected_ports_.end()); 554 DCHECK(iter != disconnected_ports_.end());
554 iter->second->SetGlobalId(global_id); 555 iter->second->SetGlobalId(global_id);
555 // Setting the global id dispatches pending messages, so we can delete the 556 // Setting the global id dispatches pending messages, so we can delete the
556 // port now. 557 // port now.
557 disconnected_ports_.erase(iter); 558 disconnected_ports_.erase(iter);
558 } 559 }
559 560
560 int MessagingBindings::GetNextLocalId() { return next_local_id_++; } 561 int MessagingBindings::GetNextLocalId() { return next_local_id_++; }
561 562
562 } // namespace extensions 563 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698