| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 11 #include "content/common/accessibility_messages.h" | 11 #include "content/common/accessibility_messages.h" |
| 12 | 12 |
| 13 typedef WebAccessibility::BoolAttribute BoolAttribute; | 13 typedef WebAccessibility::BoolAttribute BoolAttribute; |
| 14 typedef WebAccessibility::FloatAttribute FloatAttribute; | 14 typedef WebAccessibility::FloatAttribute FloatAttribute; |
| 15 typedef WebAccessibility::IntAttribute IntAttribute; | 15 typedef WebAccessibility::IntAttribute IntAttribute; |
| 16 typedef WebAccessibility::StringAttribute StringAttribute; | 16 typedef WebAccessibility::StringAttribute StringAttribute; |
| 17 | 17 |
| 18 #if !defined(OS_MACOSX) && \ | 18 #if (defined(OS_POSIX) && !defined(OS_MACOSX)) || defined(USE_AURA) |
| 19 !(defined(OS_WIN) && !defined(USE_AURA)) && \ | 19 // There's no OS-specific implementation of BrowserAccessibilityManager |
| 20 !defined(TOOLKIT_GTK) | 20 // on Unix, so just instantiate the base class. |
| 21 // We have subclassess of BrowserAccessibility on Mac, Linux/GTK, | |
| 22 // and non-Aura Win. For any other platform, instantiate the base class. | |
| 23 // static | 21 // static |
| 24 BrowserAccessibility* BrowserAccessibility::Create() { | 22 BrowserAccessibility* BrowserAccessibility::Create() { |
| 25 return new BrowserAccessibility(); | 23 return new BrowserAccessibility(); |
| 26 } | 24 } |
| 27 #endif | 25 #endif |
| 28 | 26 |
| 29 BrowserAccessibility::BrowserAccessibility() | 27 BrowserAccessibility::BrowserAccessibility() |
| 30 : manager_(NULL), | 28 : manager_(NULL), |
| 31 parent_(NULL), | 29 parent_(NULL), |
| 32 child_id_(0), | 30 child_id_(0), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 instance_active_ = false; | 195 instance_active_ = false; |
| 198 manager_->Remove(child_id_, renderer_id_); | 196 manager_->Remove(child_id_, renderer_id_); |
| 199 NativeReleaseReference(); | 197 NativeReleaseReference(); |
| 200 } | 198 } |
| 201 } | 199 } |
| 202 | 200 |
| 203 void BrowserAccessibility::NativeReleaseReference() { | 201 void BrowserAccessibility::NativeReleaseReference() { |
| 204 delete this; | 202 delete this; |
| 205 } | 203 } |
| 206 | 204 |
| 207 #if defined(OS_MACOSX) | |
| 208 BrowserAccessibilityMac* BrowserAccessibility::ToBrowserAccessibilityMac() { | |
| 209 return NULL; | |
| 210 } | |
| 211 #elif defined(OS_WIN) | |
| 212 BrowserAccessibilityWin* BrowserAccessibility::ToBrowserAccessibilityWin() { | |
| 213 return NULL; | |
| 214 } | |
| 215 #elif defined(TOOLKIT_GTK) | |
| 216 BrowserAccessibilityGtk* BrowserAccessibility::ToBrowserAccessibilityGtk() { | |
| 217 return NULL; | |
| 218 } | |
| 219 #endif | |
| 220 | |
| 221 bool BrowserAccessibility::GetBoolAttribute( | 205 bool BrowserAccessibility::GetBoolAttribute( |
| 222 BoolAttribute attribute, bool* value) const { | 206 BoolAttribute attribute, bool* value) const { |
| 223 BoolAttrMap::const_iterator iter = bool_attributes_.find(attribute); | 207 BoolAttrMap::const_iterator iter = bool_attributes_.find(attribute); |
| 224 if (iter != bool_attributes_.end()) { | 208 if (iter != bool_attributes_.end()) { |
| 225 *value = iter->second; | 209 *value = iter->second; |
| 226 return true; | 210 return true; |
| 227 } | 211 } |
| 228 | 212 |
| 229 return false; | 213 return false; |
| 230 } | 214 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 301 |
| 318 string16 result; | 302 string16 result; |
| 319 for (size_t i = 0; i < children_.size(); ++i) | 303 for (size_t i = 0; i < children_.size(); ++i) |
| 320 result += children_[i]->GetTextRecursive(); | 304 result += children_[i]->GetTextRecursive(); |
| 321 return result; | 305 return result; |
| 322 } | 306 } |
| 323 | 307 |
| 324 void BrowserAccessibility::PreInitialize() { | 308 void BrowserAccessibility::PreInitialize() { |
| 325 instance_active_ = true; | 309 instance_active_ = true; |
| 326 } | 310 } |
| OLD | NEW |