| 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_POSIX) && !defined(OS_MACOSX)) || defined(USE_AURA) | 18 #if !defined(OS_MACOSX) && \ |
| 19 // There's no OS-specific implementation of BrowserAccessibilityManager | 19 !(defined(OS_WIN) && !defined(USE_AURA)) && \ |
| 20 // on Unix, so just instantiate the base class. | 20 !defined(TOOLKIT_GTK) |
| 21 // We have subclassess of BrowserAccessibility on Mac, Linux/GTK, |
| 22 // and non-Aura Win. For any other platform, instantiate the base class. |
| 21 // static | 23 // static |
| 22 BrowserAccessibility* BrowserAccessibility::Create() { | 24 BrowserAccessibility* BrowserAccessibility::Create() { |
| 23 return new BrowserAccessibility(); | 25 return new BrowserAccessibility(); |
| 24 } | 26 } |
| 25 #endif | 27 #endif |
| 26 | 28 |
| 27 BrowserAccessibility::BrowserAccessibility() | 29 BrowserAccessibility::BrowserAccessibility() |
| 28 : manager_(NULL), | 30 : manager_(NULL), |
| 29 parent_(NULL), | 31 parent_(NULL), |
| 30 child_id_(0), | 32 child_id_(0), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 instance_active_ = false; | 197 instance_active_ = false; |
| 196 manager_->Remove(child_id_, renderer_id_); | 198 manager_->Remove(child_id_, renderer_id_); |
| 197 NativeReleaseReference(); | 199 NativeReleaseReference(); |
| 198 } | 200 } |
| 199 } | 201 } |
| 200 | 202 |
| 201 void BrowserAccessibility::NativeReleaseReference() { | 203 void BrowserAccessibility::NativeReleaseReference() { |
| 202 delete this; | 204 delete this; |
| 203 } | 205 } |
| 204 | 206 |
| 207 #if defined(OS_MACOSX) && __OBJC__ |
| 208 BrowserAccessibilityCocoa* |
| 209 BrowserAccessibility::ToBrowserAccessibilityCocoa() { |
| 210 return NULL; |
| 211 } |
| 212 #elif defined(OS_WIN) |
| 213 BrowserAccessibilityWin* BrowserAccessibility::ToBrowserAccessibilityWin() { |
| 214 return NULL; |
| 215 } |
| 216 #elif defined(TOOLKIT_GTK) |
| 217 BrowserAccessibilityGtk* BrowserAccessibility::ToBrowserAccessibilityGtk() { |
| 218 return NULL; |
| 219 } |
| 220 #endif |
| 221 |
| 205 bool BrowserAccessibility::GetBoolAttribute( | 222 bool BrowserAccessibility::GetBoolAttribute( |
| 206 BoolAttribute attribute, bool* value) const { | 223 BoolAttribute attribute, bool* value) const { |
| 207 BoolAttrMap::const_iterator iter = bool_attributes_.find(attribute); | 224 BoolAttrMap::const_iterator iter = bool_attributes_.find(attribute); |
| 208 if (iter != bool_attributes_.end()) { | 225 if (iter != bool_attributes_.end()) { |
| 209 *value = iter->second; | 226 *value = iter->second; |
| 210 return true; | 227 return true; |
| 211 } | 228 } |
| 212 | 229 |
| 213 return false; | 230 return false; |
| 214 } | 231 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 318 |
| 302 string16 result; | 319 string16 result; |
| 303 for (size_t i = 0; i < children_.size(); ++i) | 320 for (size_t i = 0; i < children_.size(); ++i) |
| 304 result += children_[i]->GetTextRecursive(); | 321 result += children_[i]->GetTextRecursive(); |
| 305 return result; | 322 return result; |
| 306 } | 323 } |
| 307 | 324 |
| 308 void BrowserAccessibility::PreInitialize() { | 325 void BrowserAccessibility::PreInitialize() { |
| 309 instance_active_ = true; | 326 instance_active_ = true; |
| 310 } | 327 } |
| OLD | NEW |