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

Side by Side Diff: content/shell/renderer/test_runner/text_input_controller.cc

Issue 259993003: Make sure gin Handles exist before using them (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.cc ('k') | no next file » | 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 "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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Handle<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())
72 return;
71 v8::Handle<v8::Object> global = context->Global(); 73 v8::Handle<v8::Object> global = context->Global();
72 global->Set(gin::StringToV8(isolate, "textInputController"), bindings.ToV8()); 74 global->Set(gin::StringToV8(isolate, "textInputController"), bindings.ToV8());
73 } 75 }
74 76
75 TextInputControllerBindings::TextInputControllerBindings( 77 TextInputControllerBindings::TextInputControllerBindings(
76 base::WeakPtr<TextInputController> controller) 78 base::WeakPtr<TextInputController> controller)
77 : controller_(controller) {} 79 : controller_(controller) {}
78 80
79 TextInputControllerBindings::~TextInputControllerBindings() {} 81 TextInputControllerBindings::~TextInputControllerBindings() {}
80 82
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY 255 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY
254 key_down.setKeyIdentifierFromWindowsKeyCode(); 256 key_down.setKeyIdentifierFromWindowsKeyCode();
255 view_->handleInputEvent(key_down); 257 view_->handleInputEvent(key_down);
256 258
257 blink::WebVector<blink::WebCompositionUnderline> underlines; 259 blink::WebVector<blink::WebCompositionUnderline> underlines;
258 blink::WebString web_text(blink::WebString::fromUTF8(text)); 260 blink::WebString web_text(blink::WebString::fromUTF8(text));
259 view_->setComposition(web_text, underlines, 0, web_text.length()); 261 view_->setComposition(web_text, underlines, 0, web_text.length());
260 } 262 }
261 263
262 } // namespace content 264 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698