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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_highlight_manager.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: Move initialization to header, fix compile error 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h" 6 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h"
7 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" 7 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h"
8 #include "content/public/browser/focused_node_details.h" 8 #include "content/public/browser/focused_node_details.h"
9 #include "content/public/browser/notification_service.h" 9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/notification_types.h" 10 #include "content/public/browser/notification_types.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 AccessibilityHighlightManager::~AccessibilityHighlightManager() { 47 AccessibilityHighlightManager::~AccessibilityHighlightManager() {
48 // No need to do anything during shutdown 48 // No need to do anything during shutdown
49 if (!ash::Shell::HasInstance()) 49 if (!ash::Shell::HasInstance())
50 return; 50 return;
51 51
52 ash::Shell* shell = ash::Shell::GetInstance(); 52 ash::Shell* shell = ash::Shell::GetInstance();
53 if (shell) { 53 if (shell) {
54 shell->RemovePreTargetHandler(this); 54 shell->RemovePreTargetHandler(this);
55 55
56 AccessibilityFocusRingController::GetInstance()->SetFocusRing( 56 AccessibilityFocusRingController::GetInstance()->SetFocusRing(
57 std::vector<gfx::Rect>()); 57 std::vector<gfx::Rect>(),
58 AccessibilityFocusRingController::FADE_OUT_FOCUS_RING);
58 AccessibilityFocusRingController::GetInstance()->SetCaretRing( 59 AccessibilityFocusRingController::GetInstance()->SetCaretRing(
59 OffscreenPoint()); 60 OffscreenPoint());
60 AccessibilityFocusRingController::GetInstance()->SetCursorRing( 61 AccessibilityFocusRingController::GetInstance()->SetCursorRing(
61 OffscreenPoint()); 62 OffscreenPoint());
62 63
63 aura::Window* root_window = shell->GetPrimaryRootWindow(); 64 aura::Window* root_window = shell->GetPrimaryRootWindow();
64 ui::InputMethod* input_method = GetInputMethod(root_window); 65 ui::InputMethod* input_method = GetInputMethod(root_window);
65 input_method->RemoveObserver(this); 66 input_method->RemoveObserver(this);
66 } 67 }
67 } 68 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 UpdateFocusAndCaretHighlights(); 120 UpdateFocusAndCaretHighlights();
120 } 121 }
121 122
122 void AccessibilityHighlightManager::UpdateFocusAndCaretHighlights() { 123 void AccessibilityHighlightManager::UpdateFocusAndCaretHighlights() {
123 auto controller = AccessibilityFocusRingController::GetInstance(); 124 auto controller = AccessibilityFocusRingController::GetInstance();
124 125
125 // The caret highlight takes precedence over the focus highlight if 126 // The caret highlight takes precedence over the focus highlight if
126 // both are visible. 127 // both are visible.
127 if (caret_ && caret_visible_) { 128 if (caret_ && caret_visible_) {
128 controller->SetCaretRing(caret_point_); 129 controller->SetCaretRing(caret_point_);
129 controller->SetFocusRing(std::vector<gfx::Rect>()); 130 controller->SetFocusRing(
131 std::vector<gfx::Rect>(),
132 AccessibilityFocusRingController::FADE_OUT_FOCUS_RING);
130 } else if (focus_) { 133 } else if (focus_) {
131 controller->SetCaretRing(OffscreenPoint()); 134 controller->SetCaretRing(OffscreenPoint());
132 std::vector<gfx::Rect> rects; 135 std::vector<gfx::Rect> rects;
133 if (!focus_rect_.IsEmpty()) 136 if (!focus_rect_.IsEmpty())
134 rects.push_back(focus_rect_); 137 rects.push_back(focus_rect_);
135 controller->SetFocusRing(rects); 138 controller->SetFocusRing(
139 rects, AccessibilityFocusRingController::FADE_OUT_FOCUS_RING);
136 } else { 140 } else {
137 controller->SetCaretRing(OffscreenPoint()); 141 controller->SetCaretRing(OffscreenPoint());
138 controller->SetFocusRing(std::vector<gfx::Rect>()); 142 controller->SetFocusRing(
143 std::vector<gfx::Rect>(),
144 AccessibilityFocusRingController::FADE_OUT_FOCUS_RING);
139 } 145 }
140 } 146 }
141 147
142 } // namespace chromeos 148 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698