OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/accessibility_event_router_views.h" | 5 #include "chrome/browser/ui/views/accessibility_event_router_views.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 view->GetAccessibleState(&state); | 119 view->GetAccessibleState(&state); |
120 return UTF16ToUTF8(state.name); | 120 return UTF16ToUTF8(state.name); |
121 } | 121 } |
122 | 122 |
123 void AccessibilityEventRouterViews::DispatchAccessibilityNotification( | 123 void AccessibilityEventRouterViews::DispatchAccessibilityNotification( |
124 views::View* view, NotificationType type) { | 124 views::View* view, NotificationType type) { |
125 // Get the profile associated with this view. If it's not found, use | 125 // Get the profile associated with this view. If it's not found, use |
126 // the most recent profile where accessibility events were sent, or | 126 // the most recent profile where accessibility events were sent, or |
127 // the default profile. | 127 // the default profile. |
128 Profile* profile = NULL; | 128 Profile* profile = NULL; |
129 views::Window* window = view->GetWindow(); | 129 views::Widget* widget = view->GetWidget(); |
130 if (window) { | 130 if (widget) { |
131 profile = reinterpret_cast<Profile*>( | 131 profile = reinterpret_cast<Profile*>( |
132 window->AsWidget()->native_widget()->GetNativeWindowProperty( | 132 widget->native_widget()->GetNativeWindowProperty(Profile::kProfileKey)); |
133 Profile::kProfileKey)); | |
134 } | 133 } |
135 if (!profile) | 134 if (!profile) |
136 profile = most_recent_profile_; | 135 profile = most_recent_profile_; |
137 if (!profile) | 136 if (!profile) |
138 profile = g_browser_process->profile_manager()->GetDefaultProfile(); | 137 profile = g_browser_process->profile_manager()->GetDefaultProfile(); |
139 if (!profile) { | 138 if (!profile) { |
140 NOTREACHED(); | 139 NOTREACHED(); |
141 return; | 140 return; |
142 } | 141 } |
143 | 142 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 views::View* view, NotificationType type, Profile* profile) { | 287 views::View* view, NotificationType type, Profile* profile) { |
289 ui::AccessibleViewState state; | 288 ui::AccessibleViewState state; |
290 view->GetAccessibleState(&state); | 289 view->GetAccessibleState(&state); |
291 std::string name = UTF16ToUTF8(state.name); | 290 std::string name = UTF16ToUTF8(state.name); |
292 std::string value = UTF16ToUTF8(state.value); | 291 std::string value = UTF16ToUTF8(state.value); |
293 AccessibilityCheckboxInfo info( | 292 AccessibilityCheckboxInfo info( |
294 profile, name, state.state == ui::AccessibilityTypes::STATE_CHECKED); | 293 profile, name, state.state == ui::AccessibilityTypes::STATE_CHECKED); |
295 SendAccessibilityNotification(type, &info); | 294 SendAccessibilityNotification(type, &info); |
296 } | 295 } |
297 | 296 |
OLD | NEW |