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

Side by Side Diff: ash/wm/ash_native_cursor_manager.cc

Issue 2833163002: Change ui cursor identifiers to an enum class. (Closed)
Patch Set: OK, it can't be explicit for mac. Created 3 years, 8 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
« no previous file with comments | « ash/utility/screenshot_controller.cc ('k') | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 ->cursor_window_controller() 86 ->cursor_window_controller()
87 ->SetDisplay(display); 87 ->SetDisplay(display);
88 } 88 }
89 89
90 void AshNativeCursorManager::SetCursor( 90 void AshNativeCursorManager::SetCursor(
91 gfx::NativeCursor cursor, 91 gfx::NativeCursor cursor,
92 ::wm::NativeCursorManagerDelegate* delegate) { 92 ::wm::NativeCursorManagerDelegate* delegate) {
93 if (native_cursor_enabled_) { 93 if (native_cursor_enabled_) {
94 image_cursors_->SetPlatformCursor(&cursor); 94 image_cursors_->SetPlatformCursor(&cursor);
95 } else { 95 } else {
96 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 96 gfx::NativeCursor invisible_cursor(ui::CursorType::kNone);
97 image_cursors_->SetPlatformCursor(&invisible_cursor); 97 image_cursors_->SetPlatformCursor(&invisible_cursor);
98 if (cursor == ui::kCursorCustom) { 98 if (cursor == ui::CursorType::kCustom) {
99 // Fall back to the default pointer cursor for now. (crbug.com/476078) 99 // Fall back to the default pointer cursor for now. (crbug.com/476078)
100 // TODO(oshima): support custom cursor. 100 // TODO(oshima): support custom cursor.
101 cursor = ui::kCursorPointer; 101 cursor = ui::CursorType::kPointer;
102 } else { 102 } else {
103 cursor.SetPlatformCursor(invisible_cursor.platform()); 103 cursor.SetPlatformCursor(invisible_cursor.platform());
104 } 104 }
105 } 105 }
106 cursor.set_device_scale_factor(image_cursors_->GetScale()); 106 cursor.set_device_scale_factor(image_cursors_->GetScale());
107 107
108 delegate->CommitCursor(cursor); 108 delegate->CommitCursor(cursor);
109 109
110 if (delegate->IsCursorVisible()) 110 if (delegate->IsCursorVisible())
111 SetCursorOnAllRootWindows(cursor); 111 SetCursorOnAllRootWindows(cursor);
(...skipping 16 matching lines...) Expand all
128 } 128 }
129 129
130 void AshNativeCursorManager::SetVisibility( 130 void AshNativeCursorManager::SetVisibility(
131 bool visible, 131 bool visible,
132 ::wm::NativeCursorManagerDelegate* delegate) { 132 ::wm::NativeCursorManagerDelegate* delegate) {
133 delegate->CommitVisibility(visible); 133 delegate->CommitVisibility(visible);
134 134
135 if (visible) { 135 if (visible) {
136 SetCursor(delegate->GetCursor(), delegate); 136 SetCursor(delegate->GetCursor(), delegate);
137 } else { 137 } else {
138 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 138 gfx::NativeCursor invisible_cursor(ui::CursorType::kNone);
139 image_cursors_->SetPlatformCursor(&invisible_cursor); 139 image_cursors_->SetPlatformCursor(&invisible_cursor);
140 SetCursorOnAllRootWindows(invisible_cursor); 140 SetCursorOnAllRootWindows(invisible_cursor);
141 } 141 }
142 142
143 NotifyCursorVisibilityChange(visible); 143 NotifyCursorVisibilityChange(visible);
144 } 144 }
145 145
146 void AshNativeCursorManager::SetMouseEventsEnabled( 146 void AshNativeCursorManager::SetMouseEventsEnabled(
147 bool enabled, 147 bool enabled,
148 ::wm::NativeCursorManagerDelegate* delegate) { 148 ::wm::NativeCursorManagerDelegate* delegate) {
149 delegate->CommitMouseEventsEnabled(enabled); 149 delegate->CommitMouseEventsEnabled(enabled);
150 150
151 if (enabled) { 151 if (enabled) {
152 aura::Env::GetInstance()->set_last_mouse_location( 152 aura::Env::GetInstance()->set_last_mouse_location(
153 disabled_cursor_location_); 153 disabled_cursor_location_);
154 } else { 154 } else {
155 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); 155 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location();
156 } 156 }
157 157
158 SetVisibility(delegate->IsCursorVisible(), delegate); 158 SetVisibility(delegate->IsCursorVisible(), delegate);
159 NotifyMouseEventsEnableStateChange(enabled); 159 NotifyMouseEventsEnableStateChange(enabled);
160 } 160 }
161 161
162 } // namespace ash 162 } // namespace ash
OLDNEW
« no previous file with comments | « ash/utility/screenshot_controller.cc ('k') | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698