| 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 "content/shell/renderer/test_runner/text_input_controller.h" | 5 #include "content/shell/renderer/test_runner/text_input_controller.h" |
| 6 | 6 |
| 7 #include "gin/arguments.h" | 7 #include "gin/arguments.h" |
| 8 #include "gin/handle.h" | 8 #include "gin/handle.h" |
| 9 #include "gin/object_template_builder.h" | 9 #include "gin/object_template_builder.h" |
| 10 #include "gin/wrappable.h" | 10 #include "gin/wrappable.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 gin::WrapperInfo TextInputControllerBindings::kWrapperInfo = { | 54 gin::WrapperInfo TextInputControllerBindings::kWrapperInfo = { |
| 55 gin::kEmbedderNativeGin}; | 55 gin::kEmbedderNativeGin}; |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 void TextInputControllerBindings::Install( | 58 void TextInputControllerBindings::Install( |
| 59 base::WeakPtr<TextInputController> controller, | 59 base::WeakPtr<TextInputController> controller, |
| 60 blink::WebFrame* frame) { | 60 blink::WebFrame* frame) { |
| 61 v8::Isolate* isolate = blink::mainThreadIsolate(); | 61 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 62 v8::HandleScope handle_scope(isolate); | 62 v8::HandleScope handle_scope(isolate); |
| 63 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); | 63 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
| 64 if (context.IsEmpty()) | 64 if (context.IsEmpty()) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 v8::Context::Scope context_scope(context); | 67 v8::Context::Scope context_scope(context); |
| 68 | 68 |
| 69 gin::Handle<TextInputControllerBindings> bindings = | 69 gin::Handle<TextInputControllerBindings> bindings = |
| 70 gin::CreateHandle(isolate, new TextInputControllerBindings(controller)); | 70 gin::CreateHandle(isolate, new TextInputControllerBindings(controller)); |
| 71 if (bindings.IsEmpty()) | 71 if (bindings.IsEmpty()) |
| 72 return; | 72 return; |
| 73 v8::Handle<v8::Object> global = context->Global(); | 73 v8::Local<v8::Object> global = context->Global(); |
| 74 global->Set(gin::StringToV8(isolate, "textInputController"), bindings.ToV8()); | 74 global->Set(gin::StringToV8(isolate, "textInputController"), bindings.ToV8()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 TextInputControllerBindings::TextInputControllerBindings( | 77 TextInputControllerBindings::TextInputControllerBindings( |
| 78 base::WeakPtr<TextInputController> controller) | 78 base::WeakPtr<TextInputController> controller) |
| 79 : controller_(controller) {} | 79 : controller_(controller) {} |
| 80 | 80 |
| 81 TextInputControllerBindings::~TextInputControllerBindings() {} | 81 TextInputControllerBindings::~TextInputControllerBindings() {} |
| 82 | 82 |
| 83 gin::ObjectTemplateBuilder | 83 gin::ObjectTemplateBuilder |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY | 255 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY |
| 256 key_down.setKeyIdentifierFromWindowsKeyCode(); | 256 key_down.setKeyIdentifierFromWindowsKeyCode(); |
| 257 view_->handleInputEvent(key_down); | 257 view_->handleInputEvent(key_down); |
| 258 | 258 |
| 259 blink::WebVector<blink::WebCompositionUnderline> underlines; | 259 blink::WebVector<blink::WebCompositionUnderline> underlines; |
| 260 blink::WebString web_text(blink::WebString::fromUTF8(text)); | 260 blink::WebString web_text(blink::WebString::fromUTF8(text)); |
| 261 view_->setComposition(web_text, underlines, 0, web_text.length()); | 261 view_->setComposition(web_text, underlines, 0, web_text.length()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace content | 264 } // namespace content |
| OLD | NEW |