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

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

Issue 2046563009: Make the focus, caret, and cursor highlights fade out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 17 matching lines...) Expand all
28 #include "extensions/common/error_utils.h" 28 #include "extensions/common/error_utils.h"
29 #include "extensions/common/manifest_handlers/background_info.h" 29 #include "extensions/common/manifest_handlers/background_info.h"
30 30
31 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
33 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" 33 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h"
34 #endif 34 #endif
35 35
36 namespace accessibility_private = extensions::api::accessibility_private; 36 namespace accessibility_private = extensions::api::accessibility_private;
37 37
38 using chromeos::AccessibilityFocusRingController;
39
38 namespace { 40 namespace {
39 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
40 // ScreenRect fields. 42 // ScreenRect fields.
41 const char kLeft[] = "left"; 43 const char kLeft[] = "left";
42 const char kTop[] = "top"; 44 const char kTop[] = "top";
43 const char kWidth[] = "width"; 45 const char kWidth[] = "width";
44 const char kHeight[] = "height"; 46 const char kHeight[] = "height";
45 #endif // defined(OS_CHROMEOS) 47 #endif // defined(OS_CHROMEOS)
46 48
47 const char kErrorNotSupported[] = "This API is not supported on this platform."; 49 const char kErrorNotSupported[] = "This API is not supported on this platform.";
(...skipping 23 matching lines...) Expand all
71 EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value)); 73 EXTENSION_FUNCTION_VALIDATE(rect_values->GetDictionary(i, &rect_value));
72 int left, top, width, height; 74 int left, top, width, height;
73 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kLeft, &left)); 75 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kLeft, &left));
74 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kTop, &top)); 76 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kTop, &top));
75 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kWidth, &width)); 77 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kWidth, &width));
76 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kHeight, &height)); 78 EXTENSION_FUNCTION_VALIDATE(rect_value->GetInteger(kHeight, &height));
77 rects.push_back(gfx::Rect(left, top, width, height)); 79 rects.push_back(gfx::Rect(left, top, width, height));
78 } 80 }
79 81
80 // Move the visible focus ring to cover all of these rects. 82 // Move the visible focus ring to cover all of these rects.
81 chromeos::AccessibilityFocusRingController::GetInstance()->SetFocusRing( 83 AccessibilityFocusRingController::GetInstance()->SetFocusRing(
82 rects); 84 rects, AccessibilityFocusRingController::PERSIST_FOCUS_RING);
83 85
84 // Also update the touch exploration controller so that synthesized 86 // Also update the touch exploration controller so that synthesized
85 // touch events are anchored within the focused object. 87 // touch events are anchored within the focused object.
86 if (!rects.empty()) { 88 if (!rects.empty()) {
87 chromeos::AccessibilityManager* manager = 89 chromeos::AccessibilityManager* manager =
88 chromeos::AccessibilityManager::Get(); 90 chromeos::AccessibilityManager::Get();
89 manager->SetTouchAccessibilityAnchorPoint(rects[0].CenterPoint()); 91 manager->SetTouchAccessibilityAnchorPoint(rects[0].CenterPoint());
90 } 92 }
91 93
92 return true; 94 return true;
(...skipping 28 matching lines...) Expand all
121 } else { 123 } else {
122 manager->SetKeyboardListenerExtensionId(std::string(), 124 manager->SetKeyboardListenerExtensionId(std::string(),
123 details.GetProfile()); 125 details.GetProfile());
124 manager->set_keyboard_listener_capture(false); 126 manager->set_keyboard_listener_capture(false);
125 } 127 }
126 return RespondNow(NoArguments()); 128 return RespondNow(NoArguments());
127 #endif // defined OS_CHROMEOS 129 #endif // defined OS_CHROMEOS
128 130
129 return RespondNow(Error(kErrorNotSupported)); 131 return RespondNow(Error(kErrorNotSupported));
130 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698