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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_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
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 "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/aura/window_tree_host.h" 10 #include "ui/aura/window_tree_host.h"
11 #include "ui/base/cursor/cursor_loader.h" 11 #include "ui/base/cursor/cursor_loader.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 DesktopNativeCursorManager::DesktopNativeCursorManager() 15 DesktopNativeCursorManager::DesktopNativeCursorManager()
16 : cursor_loader_(ui::CursorLoader::Create()) {} 16 : cursor_loader_(ui::CursorLoader::Create()) {}
17 17
18 DesktopNativeCursorManager::~DesktopNativeCursorManager() { 18 DesktopNativeCursorManager::~DesktopNativeCursorManager() {
19 } 19 }
20 20
21 gfx::NativeCursor DesktopNativeCursorManager::GetInitializedCursor(int type) { 21 gfx::NativeCursor DesktopNativeCursorManager::GetInitializedCursor(
22 ui::CursorType type) {
22 gfx::NativeCursor cursor(type); 23 gfx::NativeCursor cursor(type);
23 cursor_loader_->SetPlatformCursor(&cursor); 24 cursor_loader_->SetPlatformCursor(&cursor);
24 return cursor; 25 return cursor;
25 } 26 }
26 27
27 void DesktopNativeCursorManager::AddHost(aura::WindowTreeHost* host) { 28 void DesktopNativeCursorManager::AddHost(aura::WindowTreeHost* host) {
28 hosts_.insert(host); 29 hosts_.insert(host);
29 } 30 }
30 31
31 void DesktopNativeCursorManager::RemoveHost(aura::WindowTreeHost* host) { 32 void DesktopNativeCursorManager::RemoveHost(aura::WindowTreeHost* host) {
(...skipping 24 matching lines...) Expand all
56 } 57 }
57 58
58 void DesktopNativeCursorManager::SetVisibility( 59 void DesktopNativeCursorManager::SetVisibility(
59 bool visible, 60 bool visible,
60 wm::NativeCursorManagerDelegate* delegate) { 61 wm::NativeCursorManagerDelegate* delegate) {
61 delegate->CommitVisibility(visible); 62 delegate->CommitVisibility(visible);
62 63
63 if (visible) { 64 if (visible) {
64 SetCursor(delegate->GetCursor(), delegate); 65 SetCursor(delegate->GetCursor(), delegate);
65 } else { 66 } else {
66 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 67 gfx::NativeCursor invisible_cursor(ui::CursorType::kNone);
67 cursor_loader_->SetPlatformCursor(&invisible_cursor); 68 cursor_loader_->SetPlatformCursor(&invisible_cursor);
68 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 69 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
69 (*i)->SetCursor(invisible_cursor); 70 (*i)->SetCursor(invisible_cursor);
70 } 71 }
71 72
72 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 73 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
73 (*i)->OnCursorVisibilityChanged(visible); 74 (*i)->OnCursorVisibilityChanged(visible);
74 } 75 }
75 76
76 void DesktopNativeCursorManager::SetCursorSet( 77 void DesktopNativeCursorManager::SetCursorSet(
(...skipping 10 matching lines...) Expand all
87 // TODO(erg): In the ash version, we set the last mouse location on Env. I'm 88 // TODO(erg): In the ash version, we set the last mouse location on Env. I'm
88 // not sure this concept makes sense on the desktop. 89 // not sure this concept makes sense on the desktop.
89 90
90 SetVisibility(delegate->IsCursorVisible(), delegate); 91 SetVisibility(delegate->IsCursorVisible(), delegate);
91 92
92 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 93 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
93 (*i)->dispatcher()->OnMouseEventsEnableStateChanged(enabled); 94 (*i)->dispatcher()->OnMouseEventsEnableStateChanged(enabled);
94 } 95 }
95 96
96 } // namespace views 97 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698