| OLD | NEW |
| 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 "ash/wm/ash_native_cursor_manager.h" | 5 #include "ash/wm/ash_native_cursor_manager.h" |
| 6 | 6 |
| 7 #include "ash/display/cursor_window_controller.h" | 7 #include "ash/display/cursor_window_controller.h" |
| 8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 void AshNativeCursorManager::SetNativeCursorEnabled(bool enabled) { | 69 void AshNativeCursorManager::SetNativeCursorEnabled(bool enabled) { |
| 70 native_cursor_enabled_ = enabled; | 70 native_cursor_enabled_ = enabled; |
| 71 | 71 |
| 72 ::wm::CursorManager* cursor_manager = | 72 ::wm::CursorManager* cursor_manager = |
| 73 Shell::GetInstance()->cursor_manager(); | 73 Shell::GetInstance()->cursor_manager(); |
| 74 SetCursor(cursor_manager->GetCursor(), cursor_manager); | 74 SetCursor(cursor_manager->GetCursor(), cursor_manager); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AshNativeCursorManager::SetDisplay( | 77 void AshNativeCursorManager::SetDisplay( |
| 78 const gfx::Display& display, | 78 const display::Display& display, |
| 79 ::wm::NativeCursorManagerDelegate* delegate) { | 79 ::wm::NativeCursorManagerDelegate* delegate) { |
| 80 DCHECK(display.is_valid()); | 80 DCHECK(display.is_valid()); |
| 81 // Use the platform's device scale factor instead of the display's, which | 81 // Use the platform's device scale factor instead of the display's, which |
| 82 // might have been adjusted for the UI scale. | 82 // might have been adjusted for the UI scale. |
| 83 const float original_scale = Shell::GetInstance()->display_manager()-> | 83 const float original_scale = Shell::GetInstance()->display_manager()-> |
| 84 GetDisplayInfo(display.id()).device_scale_factor(); | 84 GetDisplayInfo(display.id()).device_scale_factor(); |
| 85 #if defined(OS_CHROMEOS) | 85 #if defined(OS_CHROMEOS) |
| 86 // And use the nearest resource scale factor. | 86 // And use the nearest resource scale factor. |
| 87 const float cursor_scale = ui::GetScaleForScaleFactor( | 87 const float cursor_scale = ui::GetScaleForScaleFactor( |
| 88 ui::GetSupportedScaleFactor(original_scale)); | 88 ui::GetSupportedScaleFactor(original_scale)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 disabled_cursor_location_); | 168 disabled_cursor_location_); |
| 169 } else { | 169 } else { |
| 170 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); | 170 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 SetVisibility(delegate->IsCursorVisible(), delegate); | 173 SetVisibility(delegate->IsCursorVisible(), delegate); |
| 174 NotifyMouseEventsEnableStateChange(enabled); | 174 NotifyMouseEventsEnableStateChange(enabled); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace ash | 177 } // namespace ash |
| OLD | NEW |