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

Side by Side Diff: chrome/browser/accessibility/accessibility_extension_api.cc

Issue 2768703002: Wire up an api to darken screen for accessibility (Closed)
Patch Set: Rebase. 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 (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 "chrome/browser/accessibility/accessibility_extension_api.h" 5 #include "chrome/browser/accessibility/accessibility_extension_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/browser/browser_accessibility_state.h" 23 #include "content/public/browser/browser_accessibility_state.h"
24 #include "extensions/browser/event_router.h" 24 #include "extensions/browser/event_router.h"
25 #include "extensions/browser/extension_system.h" 25 #include "extensions/browser/extension_system.h"
26 #include "extensions/browser/lazy_background_task_queue.h" 26 #include "extensions/browser/lazy_background_task_queue.h"
27 #include "extensions/common/error_utils.h" 27 #include "extensions/common/error_utils.h"
28 #include "extensions/common/manifest_handlers/background_info.h" 28 #include "extensions/common/manifest_handlers/background_info.h"
29 29
30 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
32 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" 32 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h"
33 #include "chromeos/dbus/dbus_thread_manager.h"
34 #include "chromeos/dbus/power_manager_client.h"
35
33 using chromeos::AccessibilityFocusRingController; 36 using chromeos::AccessibilityFocusRingController;
34 #endif 37 #endif
35 38
36 namespace accessibility_private = extensions::api::accessibility_private; 39 namespace accessibility_private = extensions::api::accessibility_private;
37 40
38 namespace { 41 namespace {
39 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
40 // ScreenRect fields. 43 // ScreenRect fields.
41 const char kLeft[] = "left"; 44 const char kLeft[] = "left";
42 const char kTop[] = "top"; 45 const char kTop[] = "top";
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } else { 125 } else {
123 manager->SetKeyboardListenerExtensionId(std::string(), 126 manager->SetKeyboardListenerExtensionId(std::string(),
124 details.GetProfile()); 127 details.GetProfile());
125 manager->set_keyboard_listener_capture(false); 128 manager->set_keyboard_listener_capture(false);
126 } 129 }
127 return RespondNow(NoArguments()); 130 return RespondNow(NoArguments());
128 #endif // defined OS_CHROMEOS 131 #endif // defined OS_CHROMEOS
129 132
130 return RespondNow(Error(kErrorNotSupported)); 133 return RespondNow(Error(kErrorNotSupported));
131 } 134 }
135
136 ExtensionFunction::ResponseAction
137 AccessibilityPrivateDarkenScreenFunction::Run() {
138 ChromeExtensionFunctionDetails details(this);
139 CHECK(extension());
140
141 #if defined(OS_CHROMEOS)
142 bool darken;
143 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(0, &darken));
144 chromeos::PowerManagerClient* client =
145 chromeos::DBusThreadManager::Get()->GetPowerManagerClient();
146
147 // Called twice to ensure the cros end of the dbus message is in a good
148 // state.
149 client->SetBacklightsForcedOff(!darken);
150 client->SetBacklightsForcedOff(darken);
151 return RespondNow(NoArguments());
152 #endif // defined OS_CHROMEOS
153
154 return RespondNow(Error(kErrorNotSupported));
155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698