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

Side by Side Diff: content/browser/accessibility/browser_accessibility_gtk.cc

Issue 10382222: Cache accessibility description rather than returning temporary. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « content/browser/accessibility/browser_accessibility_gtk.h ('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 (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_gtk.h" 5 #include "content/browser/accessibility/browser_accessibility_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h" 10 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 static const gchar* browser_accessibility_get_name(AtkObject* atk_object) { 38 static const gchar* browser_accessibility_get_name(AtkObject* atk_object) {
39 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); 39 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object);
40 return obj->atk_acc_name().c_str(); 40 return obj->atk_acc_name().c_str();
41 } 41 }
42 42
43 static const gchar* browser_accessibility_get_description( 43 static const gchar* browser_accessibility_get_description(
44 AtkObject* atk_object) { 44 AtkObject* atk_object) {
45 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); 45 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object);
46 string16 description; 46 return obj->atk_acc_description().c_str();
47 obj->GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &description);
48 return UTF16ToUTF8(description).c_str();
49 } 47 }
50 48
51 static AtkObject* browser_accessibility_get_parent(AtkObject* atk_object) { 49 static AtkObject* browser_accessibility_get_parent(AtkObject* atk_object) {
52 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); 50 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object);
53 if (obj->parent()) 51 if (obj->parent())
54 return obj->parent()->ToBrowserAccessibilityGtk()->GetAtkObject(); 52 return obj->parent()->ToBrowserAccessibilityGtk()->GetAtkObject();
55 else 53 else
56 return gtk_widget_get_accessible(obj->manager()->GetParentView()); 54 return gtk_widget_get_accessible(obj->manager()->GetParentView());
57 } 55 }
58 56
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 atk_object_, 304 atk_object_,
307 this->parent()->ToBrowserAccessibilityGtk()->GetAtkObject()); 305 this->parent()->ToBrowserAccessibilityGtk()->GetAtkObject());
308 } 306 }
309 } 307 }
310 308
311 bool BrowserAccessibilityGtk::IsNative() const { 309 bool BrowserAccessibilityGtk::IsNative() const {
312 return true; 310 return true;
313 } 311 }
314 312
315 void BrowserAccessibilityGtk::InitRoleAndState() { 313 void BrowserAccessibilityGtk::InitRoleAndState() {
316 atk_acc_name_ = UTF16ToUTF8(name()).c_str(); 314 atk_acc_name_ = UTF16ToUTF8(name());
315
316 string16 description;
317 GetStringAttribute(WebAccessibility::ATTR_DESCRIPTION, &description);
318 atk_acc_description_ = UTF16ToUTF8(description);
317 319
318 switch(role_) { 320 switch(role_) {
319 case WebAccessibility::ROLE_BUTTON: 321 case WebAccessibility::ROLE_BUTTON:
320 atk_role_ = ATK_ROLE_PUSH_BUTTON; 322 atk_role_ = ATK_ROLE_PUSH_BUTTON;
321 break; 323 break;
322 case WebAccessibility::ROLE_CHECKBOX: 324 case WebAccessibility::ROLE_CHECKBOX:
323 atk_role_ = ATK_ROLE_CHECK_BOX; 325 atk_role_ = ATK_ROLE_CHECK_BOX;
324 break; 326 break;
325 case WebAccessibility::ROLE_COMBO_BOX: 327 case WebAccessibility::ROLE_COMBO_BOX:
326 atk_role_ = ATK_ROLE_COMBO_BOX; 328 atk_role_ = ATK_ROLE_COMBO_BOX;
(...skipping 11 matching lines...) Expand all
338 atk_role_ = ATK_ROLE_ENTRY; 340 atk_role_ = ATK_ROLE_ENTRY;
339 break; 341 break;
340 case WebAccessibility::ROLE_WEBCORE_LINK: 342 case WebAccessibility::ROLE_WEBCORE_LINK:
341 atk_role_ = ATK_ROLE_LINK; 343 atk_role_ = ATK_ROLE_LINK;
342 break; 344 break;
343 default: 345 default:
344 atk_role_ = ATK_ROLE_UNKNOWN; 346 atk_role_ = ATK_ROLE_UNKNOWN;
345 break; 347 break;
346 } 348 }
347 } 349 }
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698