| OLD | NEW |
| 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/chromeos/ui/accessibility_focus_ring_controller.h" | 5 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (!layers_[i]) | 66 if (!layers_[i]) |
| 67 layers_[i] = new AccessibilityFocusRingLayer(this); | 67 layers_[i] = new AccessibilityFocusRingLayer(this); |
| 68 | 68 |
| 69 if (i > 0) { | 69 if (i > 0) { |
| 70 // Focus rings other than the first one don't animate. | 70 // Focus rings other than the first one don't animate. |
| 71 layers_[i]->Set(rings_[i]); | 71 layers_[i]->Set(rings_[i]); |
| 72 continue; | 72 continue; |
| 73 } | 73 } |
| 74 | 74 |
| 75 gfx::Rect bounds = rings_[0].GetBounds(); | 75 gfx::Rect bounds = rings_[0].GetBounds(); |
| 76 gfx::Display display = | 76 gfx::Display display = gfx::Screen::GetScreen()->GetDisplayMatching(bounds); |
| 77 gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds); | |
| 78 aura::Window* root_window = ash::Shell::GetInstance() | 77 aura::Window* root_window = ash::Shell::GetInstance() |
| 79 ->window_tree_host_manager() | 78 ->window_tree_host_manager() |
| 80 ->GetRootWindowForDisplayId(display.id()); | 79 ->GetRootWindowForDisplayId(display.id()); |
| 81 ui::Compositor* compositor = root_window->layer()->GetCompositor(); | 80 ui::Compositor* compositor = root_window->layer()->GetCompositor(); |
| 82 if (!compositor || root_window != layers_[0]->root_window()) { | 81 if (!compositor || root_window != layers_[0]->root_window()) { |
| 83 layers_[0]->Set(rings_[0]); | 82 layers_[0]->Set(rings_[0]); |
| 84 if (compositor_ && compositor_->HasAnimationObserver(this)) { | 83 if (compositor_ && compositor_->HasAnimationObserver(this)) { |
| 85 compositor_->RemoveAnimationObserver(this); | 84 compositor_->RemoveAnimationObserver(this); |
| 86 compositor_ = nullptr; | 85 compositor_ = nullptr; |
| 87 } | 86 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 } | 325 } |
| 327 | 326 |
| 328 void AccessibilityFocusRingController::OnCompositingShuttingDown( | 327 void AccessibilityFocusRingController::OnCompositingShuttingDown( |
| 329 ui::Compositor* compositor) { | 328 ui::Compositor* compositor) { |
| 330 DCHECK_EQ(compositor_, compositor); | 329 DCHECK_EQ(compositor_, compositor); |
| 331 compositor_->RemoveAnimationObserver(this); | 330 compositor_->RemoveAnimationObserver(this); |
| 332 compositor_ = nullptr; | 331 compositor_ = nullptr; |
| 333 } | 332 } |
| 334 | 333 |
| 335 } // namespace chromeos | 334 } // namespace chromeos |
| OLD | NEW |