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

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

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Re-add dropped null check Created 4 years, 1 month 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
« no previous file with comments | « extensions/renderer/messaging_bindings.cc ('k') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/user_gestures_native_handler.h" 5 #include "extensions/renderer/user_gestures_native_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "extensions/renderer/script_context.h" 8 #include "extensions/renderer/script_context.h"
9 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 9 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
10 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 10 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
(...skipping 18 matching lines...) Expand all
29 29
30 void UserGesturesNativeHandler::IsProcessingUserGesture( 30 void UserGesturesNativeHandler::IsProcessingUserGesture(
31 const v8::FunctionCallbackInfo<v8::Value>& args) { 31 const v8::FunctionCallbackInfo<v8::Value>& args) {
32 args.GetReturnValue().Set(v8::Boolean::New( 32 args.GetReturnValue().Set(v8::Boolean::New(
33 args.GetIsolate(), 33 args.GetIsolate(),
34 blink::WebUserGestureIndicator::isProcessingUserGesture())); 34 blink::WebUserGestureIndicator::isProcessingUserGesture()));
35 } 35 }
36 36
37 void UserGesturesNativeHandler::RunWithUserGesture( 37 void UserGesturesNativeHandler::RunWithUserGesture(
38 const v8::FunctionCallbackInfo<v8::Value>& args) { 38 const v8::FunctionCallbackInfo<v8::Value>& args) {
39 blink::WebScopedUserGesture user_gesture; 39 blink::WebScopedUserGesture user_gesture(context()->web_frame());
40 CHECK_EQ(args.Length(), 1); 40 CHECK_EQ(args.Length(), 1);
41 CHECK(args[0]->IsFunction()); 41 CHECK(args[0]->IsFunction());
42 v8::Local<v8::Value> no_args; 42 v8::Local<v8::Value> no_args;
43 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); 43 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args);
44 } 44 }
45 45
46 void UserGesturesNativeHandler::RunWithoutUserGesture( 46 void UserGesturesNativeHandler::RunWithoutUserGesture(
47 const v8::FunctionCallbackInfo<v8::Value>& args) { 47 const v8::FunctionCallbackInfo<v8::Value>& args) {
48 blink::WebUserGestureIndicator::consumeUserGesture(); 48 blink::WebUserGestureIndicator::consumeUserGesture();
49 CHECK_EQ(args.Length(), 1); 49 CHECK_EQ(args.Length(), 1);
50 CHECK(args[0]->IsFunction()); 50 CHECK(args[0]->IsFunction());
51 v8::Local<v8::Value> no_args; 51 v8::Local<v8::Value> no_args;
52 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); 52 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args);
53 } 53 }
54 54
55 } // namespace extensions 55 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/messaging_bindings.cc ('k') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698