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

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

Issue 10382051: Add initial GTK web accessibility framework (third attempt). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h"
6
7 #include "content/browser/accessibility/browser_accessibility_gtk.h"
8 #include "content/common/accessibility_messages.h"
9
10 using webkit_glue::WebAccessibility;
11
12 // static
13 BrowserAccessibilityManager* BrowserAccessibilityManager::Create(
14 gfx::NativeView parent_view,
15 const WebAccessibility& src,
16 BrowserAccessibilityDelegate* delegate,
17 BrowserAccessibilityFactory* factory) {
18 return new BrowserAccessibilityManagerGtk(
19 parent_view,
20 src,
21 delegate,
22 factory);
23 }
24
25 BrowserAccessibilityManagerGtk::BrowserAccessibilityManagerGtk(
26 GtkWidget* parent_view,
27 const WebAccessibility& src,
28 BrowserAccessibilityDelegate* delegate,
29 BrowserAccessibilityFactory* factory)
30 : BrowserAccessibilityManager(parent_view, src, delegate, factory) {
31 }
32
33 BrowserAccessibilityManagerGtk::~BrowserAccessibilityManagerGtk() {
34 }
35
36 void BrowserAccessibilityManagerGtk::NotifyAccessibilityEvent(
37 int type,
38 BrowserAccessibility* node) {
39 if (!node->IsNative())
40 return;
41 AtkObject* atk_object = node->ToBrowserAccessibilityGtk()->GetAtkObject();
42
43 switch (type) {
44 case AccessibilityNotificationChildrenChanged:
45 RecursivelySendChildrenChanged(GetRoot()->ToBrowserAccessibilityGtk());
46 break;
47 case AccessibilityNotificationFocusChanged:
48 // Note: atk_focus_tracker_notify may be deprecated in the future;
49 // follow this bug for the replacement:
50 // https://bugzilla.gnome.org/show_bug.cgi?id=649575#c4
51 g_signal_emit_by_name(atk_object, "focus-event", true);
52 atk_focus_tracker_notify(atk_object);
53 break;
54 default:
55 break;
56 }
57 }
58
59 void BrowserAccessibilityManagerGtk::RecursivelySendChildrenChanged(
60 BrowserAccessibilityGtk* node) {
61 AtkObject* atkObject = node->ToBrowserAccessibilityGtk()->GetAtkObject();
62 for (unsigned int i = 0; i < node->children().size(); ++i) {
63 BrowserAccessibilityGtk* child =
64 node->children()[i]->ToBrowserAccessibilityGtk();
65 g_signal_emit_by_name(atkObject,
66 "children-changed::add",
67 i,
68 child->GetAtkObject());
69 RecursivelySendChildrenChanged(child);
70 }
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698