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

Side by Side Diff: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc

Issue 2768703002: Wire up an api to darken screen for accessibility (Closed)
Patch Set: Cvox changes. Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/aura/accessibility/automation_manager_aura.h" 5 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h" 12 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/common/extensions/api/automation_api_constants.h" 14 #include "chrome/common/extensions/api/automation_api_constants.h"
15 #include "chrome/common/extensions/chrome_extension_messages.h" 15 #include "chrome/common/extensions/chrome_extension_messages.h"
16 #include "content/public/browser/ax_event_notification_details.h" 16 #include "content/public/browser/ax_event_notification_details.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "ui/accessibility/ax_action_data.h" 18 #include "ui/accessibility/ax_action_data.h"
19 #include "ui/accessibility/ax_enums.h" 19 #include "ui/accessibility/ax_enums.h"
20 #include "ui/accessibility/ax_tree_id_registry.h" 20 #include "ui/accessibility/ax_tree_id_registry.h"
21 #include "ui/aura/env.h" 21 #include "ui/aura/env.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" 23 #include "ui/views/accessibility/ax_aura_obj_wrapper.h"
24 #include "ui/views/view.h" 24 #include "ui/views/view.h"
25 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
26 26
27 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
28 #include "ash/wm/window_util.h" // nogncheck 28 #include "ash/wm/window_util.h" // nogncheck
29 #include "chromeos/dbus/dbus_thread_manager.h"
30 #include "chromeos/dbus/power_manager_client.h"
29 #endif 31 #endif
30 32
31 using content::BrowserContext; 33 using content::BrowserContext;
32 using extensions::AutomationEventRouter; 34 using extensions::AutomationEventRouter;
33 35
34 // static 36 // static
35 AutomationManagerAura* AutomationManagerAura::GetInstance() { 37 AutomationManagerAura* AutomationManagerAura::GetInstance() {
36 return base::Singleton<AutomationManagerAura>::get(); 38 return base::Singleton<AutomationManagerAura>::get();
37 } 39 }
38 40
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (data.anchor_node_id != data.focus_node_id) { 101 if (data.anchor_node_id != data.focus_node_id) {
100 NOTREACHED(); 102 NOTREACHED();
101 return; 103 return;
102 } 104 }
103 current_tree_->SetSelection( 105 current_tree_->SetSelection(
104 data.anchor_node_id, data.anchor_offset, data.focus_offset); 106 data.anchor_node_id, data.anchor_offset, data.focus_offset);
105 break; 107 break;
106 case ui::AX_ACTION_SHOW_CONTEXT_MENU: 108 case ui::AX_ACTION_SHOW_CONTEXT_MENU:
107 current_tree_->ShowContextMenu(data.target_node_id); 109 current_tree_->ShowContextMenu(data.target_node_id);
108 break; 110 break;
111 #if defined(OS_CHROMEOS)
112 case ui::AX_ACTION_TOGGLE_DARKEN_SCREEN:
113 chromeos::DBusThreadManager::Get()
114 ->GetPowerManagerClient()
115 ->SetBacklightsForcedOff(
116 data.GetBoolAttribute(ui::AX_ACTION_ATTR_DARKEN_SCREEN));
117 break;
118 #endif
109 case ui::AX_ACTION_SET_ACCESSIBILITY_FOCUS: 119 case ui::AX_ACTION_SET_ACCESSIBILITY_FOCUS:
110 // Sent by ChromeVox but doesn't need to be handled by aura. 120 // Sent by ChromeVox but doesn't need to be handled by aura.
111 break; 121 break;
112 case ui::AX_ACTION_SET_SEQUENTIAL_FOCUS_NAVIGATION_STARTING_POINT: 122 case ui::AX_ACTION_SET_SEQUENTIAL_FOCUS_NAVIGATION_STARTING_POINT:
113 // Sent by ChromeVox but doesn't need to be handled by aura. 123 // Sent by ChromeVox but doesn't need to be handled by aura.
114 break; 124 break;
115 case ui::AX_ACTION_BLUR: 125 case ui::AX_ACTION_BLUR:
116 case ui::AX_ACTION_DECREMENT: 126 case ui::AX_ACTION_DECREMENT:
117 case ui::AX_ACTION_GET_IMAGE_DATA: 127 case ui::AX_ACTION_GET_IMAGE_DATA:
118 case ui::AX_ACTION_HIT_TEST: 128 case ui::AX_ACTION_HIT_TEST:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 206
197 processing_events_ = false; 207 processing_events_ = false;
198 auto pending_events_copy = pending_events_; 208 auto pending_events_copy = pending_events_;
199 pending_events_.clear(); 209 pending_events_.clear();
200 for (size_t i = 0; i < pending_events_copy.size(); ++i) { 210 for (size_t i = 0; i < pending_events_copy.size(); ++i) {
201 SendEvent(context, 211 SendEvent(context,
202 pending_events_copy[i].first, 212 pending_events_copy[i].first,
203 pending_events_copy[i].second); 213 pending_events_copy[i].second);
204 } 214 }
205 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698