OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/accessibility/browser_accessibility_manager_android.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 namespace content { | 47 namespace content { |
48 | 48 |
49 namespace aria_strings { | 49 namespace aria_strings { |
50 const char kAriaLivePolite[] = "polite"; | 50 const char kAriaLivePolite[] = "polite"; |
51 const char kAriaLiveAssertive[] = "assertive"; | 51 const char kAriaLiveAssertive[] = "assertive"; |
52 } | 52 } |
53 | 53 |
54 // static | 54 // static |
55 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( | 55 BrowserAccessibilityManager* BrowserAccessibilityManager::Create( |
56 const SimpleAXTreeUpdate& initial_tree, | 56 const ui::AXTreeUpdate& initial_tree, |
57 BrowserAccessibilityDelegate* delegate, | 57 BrowserAccessibilityDelegate* delegate, |
58 BrowserAccessibilityFactory* factory) { | 58 BrowserAccessibilityFactory* factory) { |
59 return new BrowserAccessibilityManagerAndroid( | 59 return new BrowserAccessibilityManagerAndroid( |
60 ScopedJavaLocalRef<jobject>(), initial_tree, delegate, factory); | 60 ScopedJavaLocalRef<jobject>(), initial_tree, delegate, factory); |
61 } | 61 } |
62 | 62 |
63 BrowserAccessibilityManagerAndroid* | 63 BrowserAccessibilityManagerAndroid* |
64 BrowserAccessibilityManager::ToBrowserAccessibilityManagerAndroid() { | 64 BrowserAccessibilityManager::ToBrowserAccessibilityManagerAndroid() { |
65 return static_cast<BrowserAccessibilityManagerAndroid*>(this); | 65 return static_cast<BrowserAccessibilityManagerAndroid*>(this); |
66 } | 66 } |
67 | 67 |
68 BrowserAccessibilityManagerAndroid::BrowserAccessibilityManagerAndroid( | 68 BrowserAccessibilityManagerAndroid::BrowserAccessibilityManagerAndroid( |
69 ScopedJavaLocalRef<jobject> content_view_core, | 69 ScopedJavaLocalRef<jobject> content_view_core, |
70 const SimpleAXTreeUpdate& initial_tree, | 70 const ui::AXTreeUpdate& initial_tree, |
71 BrowserAccessibilityDelegate* delegate, | 71 BrowserAccessibilityDelegate* delegate, |
72 BrowserAccessibilityFactory* factory) | 72 BrowserAccessibilityFactory* factory) |
73 : BrowserAccessibilityManager(delegate, factory), | 73 : BrowserAccessibilityManager(delegate, factory), |
74 prune_tree_for_screen_reader_(true) { | 74 prune_tree_for_screen_reader_(true) { |
75 Initialize(initial_tree); | 75 Initialize(initial_tree); |
76 SetContentViewCore(content_view_core); | 76 SetContentViewCore(content_view_core); |
77 } | 77 } |
78 | 78 |
79 BrowserAccessibilityManagerAndroid::~BrowserAccessibilityManagerAndroid() { | 79 BrowserAccessibilityManagerAndroid::~BrowserAccessibilityManagerAndroid() { |
80 JNIEnv* env = AttachCurrentThread(); | 80 JNIEnv* env = AttachCurrentThread(); |
81 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 81 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
82 if (obj.is_null()) | 82 if (obj.is_null()) |
83 return; | 83 return; |
84 | 84 |
85 Java_BrowserAccessibilityManager_onNativeObjectDestroyed(env, obj.obj()); | 85 Java_BrowserAccessibilityManager_onNativeObjectDestroyed(env, obj.obj()); |
86 } | 86 } |
87 | 87 |
88 // static | 88 // static |
89 SimpleAXTreeUpdate | 89 ui::AXTreeUpdate |
90 BrowserAccessibilityManagerAndroid::GetEmptyDocument() { | 90 BrowserAccessibilityManagerAndroid::GetEmptyDocument() { |
91 ui::AXNodeData empty_document; | 91 ui::AXNodeData empty_document; |
92 empty_document.id = 0; | 92 empty_document.id = 0; |
93 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; | 93 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; |
94 empty_document.state = 1 << ui::AX_STATE_READ_ONLY; | 94 empty_document.state = 1 << ui::AX_STATE_READ_ONLY; |
95 | 95 |
96 SimpleAXTreeUpdate update; | 96 ui::AXTreeUpdate update; |
97 update.nodes.push_back(empty_document); | 97 update.nodes.push_back(empty_document); |
98 return update; | 98 return update; |
99 } | 99 } |
100 | 100 |
101 void BrowserAccessibilityManagerAndroid::SetContentViewCore( | 101 void BrowserAccessibilityManagerAndroid::SetContentViewCore( |
102 ScopedJavaLocalRef<jobject> content_view_core) { | 102 ScopedJavaLocalRef<jobject> content_view_core) { |
103 if (content_view_core.is_null()) | 103 if (content_view_core.is_null()) |
104 return; | 104 return; |
105 | 105 |
106 JNIEnv* env = AttachCurrentThread(); | 106 JNIEnv* env = AttachCurrentThread(); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 BrowserAccessibilityManagerAndroid::UseRootScrollOffsetsWhenComputingBounds() { | 781 BrowserAccessibilityManagerAndroid::UseRootScrollOffsetsWhenComputingBounds() { |
782 // The Java layer handles the root scroll offset. | 782 // The Java layer handles the root scroll offset. |
783 return false; | 783 return false; |
784 } | 784 } |
785 | 785 |
786 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { | 786 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { |
787 return RegisterNativesImpl(env); | 787 return RegisterNativesImpl(env); |
788 } | 788 } |
789 | 789 |
790 } // namespace content | 790 } // namespace content |
OLD | NEW |