| 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/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 Loading... |
| 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 |
| OLD | NEW |