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/accessibility_controller.h" | 5 #include "content/shell/renderer/test_runner/accessibility_controller.h" |
6 | 6 |
7 #include "gin/handle.h" | 7 #include "gin/handle.h" |
8 #include "gin/object_template_builder.h" | 8 #include "gin/object_template_builder.h" |
9 #include "gin/wrappable.h" | 9 #include "gin/wrappable.h" |
10 #include "third_party/WebKit/public/web/WebElement.h" | 10 #include "third_party/WebKit/public/web/WebElement.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 v8::HandleScope handle_scope(isolate); | 54 v8::HandleScope handle_scope(isolate); |
55 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); | 55 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); |
56 if (context.IsEmpty()) | 56 if (context.IsEmpty()) |
57 return; | 57 return; |
58 | 58 |
59 v8::Context::Scope context_scope(context); | 59 v8::Context::Scope context_scope(context); |
60 | 60 |
61 gin::Handle<AccessibilityControllerBindings> bindings = | 61 gin::Handle<AccessibilityControllerBindings> bindings = |
62 gin::CreateHandle(isolate, | 62 gin::CreateHandle(isolate, |
63 new AccessibilityControllerBindings(controller)); | 63 new AccessibilityControllerBindings(controller)); |
| 64 if (bindings.IsEmpty()) |
| 65 return; |
64 v8::Handle<v8::Object> global = context->Global(); | 66 v8::Handle<v8::Object> global = context->Global(); |
65 global->Set(gin::StringToV8(isolate, "accessibilityController"), | 67 global->Set(gin::StringToV8(isolate, "accessibilityController"), |
66 bindings.ToV8()); | 68 bindings.ToV8()); |
67 } | 69 } |
68 | 70 |
69 AccessibilityControllerBindings::AccessibilityControllerBindings( | 71 AccessibilityControllerBindings::AccessibilityControllerBindings( |
70 base::WeakPtr<AccessibilityController> controller) | 72 base::WeakPtr<AccessibilityController> controller) |
71 : controller_(controller) { | 73 : controller_(controller) { |
72 } | 74 } |
73 | 75 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 v8::Handle<v8::Object> result = | 268 v8::Handle<v8::Object> result = |
267 FindAccessibleElementByIdRecursive(obj.childAt(i), id); | 269 FindAccessibleElementByIdRecursive(obj.childAt(i), id); |
268 if (*result) | 270 if (*result) |
269 return result; | 271 return result; |
270 } | 272 } |
271 | 273 |
272 return v8::Handle<v8::Object>(); | 274 return v8::Handle<v8::Object>(); |
273 } | 275 } |
274 | 276 |
275 } // namespace content | 277 } // namespace content |
OLD | NEW |