| 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 args.GetReturnValue().Set(v8::Boolean::New( | 29 args.GetReturnValue().Set(v8::Boolean::New( |
| 30 args.GetIsolate(), | 30 args.GetIsolate(), |
| 31 blink::WebUserGestureIndicator::isProcessingUserGesture())); | 31 blink::WebUserGestureIndicator::isProcessingUserGesture())); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void UserGesturesNativeHandler::RunWithUserGesture( | 34 void UserGesturesNativeHandler::RunWithUserGesture( |
| 35 const v8::FunctionCallbackInfo<v8::Value>& args) { | 35 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 36 blink::WebScopedUserGesture user_gesture; | 36 blink::WebScopedUserGesture user_gesture; |
| 37 CHECK_EQ(args.Length(), 1); | 37 CHECK_EQ(args.Length(), 1); |
| 38 CHECK(args[0]->IsFunction()); | 38 CHECK(args[0]->IsFunction()); |
| 39 v8::Handle<v8::Value> no_args; | 39 v8::Local<v8::Value> no_args; |
| 40 context()->CallFunction(v8::Handle<v8::Function>::Cast(args[0]), 0, &no_args); | 40 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void UserGesturesNativeHandler::RunWithoutUserGesture( | 43 void UserGesturesNativeHandler::RunWithoutUserGesture( |
| 44 const v8::FunctionCallbackInfo<v8::Value>& args) { | 44 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 45 blink::WebUserGestureIndicator::consumeUserGesture(); | 45 blink::WebUserGestureIndicator::consumeUserGesture(); |
| 46 CHECK_EQ(args.Length(), 1); | 46 CHECK_EQ(args.Length(), 1); |
| 47 CHECK(args[0]->IsFunction()); | 47 CHECK(args[0]->IsFunction()); |
| 48 v8::Handle<v8::Value> no_args; | 48 v8::Local<v8::Value> no_args; |
| 49 context()->CallFunction(v8::Handle<v8::Function>::Cast(args[0]), 0, &no_args); | 49 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace extensions | 52 } // namespace extensions |
| OLD | NEW |