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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
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 "ui/aura/window_event_dispatcher.h" 7 #include "ui/aura/window_event_dispatcher.h"
8 #include "ui/aura/window_tree_host.h" 8 #include "ui/aura/window_tree_host.h"
9 #include "ui/base/cursor/cursor_loader.h" 9 #include "ui/base/cursor/cursor_loader.h"
10 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" 10 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h"
(...skipping 20 matching lines...) Expand all
31 void DesktopNativeCursorManager::AddHost(aura::WindowTreeHost* host) { 31 void DesktopNativeCursorManager::AddHost(aura::WindowTreeHost* host) {
32 hosts_.insert(host); 32 hosts_.insert(host);
33 } 33 }
34 34
35 void DesktopNativeCursorManager::RemoveHost(aura::WindowTreeHost* host) { 35 void DesktopNativeCursorManager::RemoveHost(aura::WindowTreeHost* host) {
36 hosts_.erase(host); 36 hosts_.erase(host);
37 } 37 }
38 38
39 void DesktopNativeCursorManager::SetDisplay( 39 void DesktopNativeCursorManager::SetDisplay(
40 const gfx::Display& display, 40 const gfx::Display& display,
41 views::corewm::NativeCursorManagerDelegate* delegate) { 41 wm::NativeCursorManagerDelegate* delegate) {
42 cursor_loader_->UnloadAll(); 42 cursor_loader_->UnloadAll();
43 cursor_loader_->set_display(display); 43 cursor_loader_->set_display(display);
44 44
45 if (cursor_loader_updater_.get()) 45 if (cursor_loader_updater_.get())
46 cursor_loader_updater_->OnDisplayUpdated(display, cursor_loader_.get()); 46 cursor_loader_updater_->OnDisplayUpdated(display, cursor_loader_.get());
47 47
48 SetCursor(delegate->GetCursor(), delegate); 48 SetCursor(delegate->GetCursor(), delegate);
49 } 49 }
50 50
51 void DesktopNativeCursorManager::SetCursor( 51 void DesktopNativeCursorManager::SetCursor(
52 gfx::NativeCursor cursor, 52 gfx::NativeCursor cursor,
53 views::corewm::NativeCursorManagerDelegate* delegate) { 53 wm::NativeCursorManagerDelegate* delegate) {
54 gfx::NativeCursor new_cursor = cursor; 54 gfx::NativeCursor new_cursor = cursor;
55 cursor_loader_->SetPlatformCursor(&new_cursor); 55 cursor_loader_->SetPlatformCursor(&new_cursor);
56 delegate->CommitCursor(new_cursor); 56 delegate->CommitCursor(new_cursor);
57 57
58 if (delegate->IsCursorVisible()) { 58 if (delegate->IsCursorVisible()) {
59 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 59 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
60 (*i)->SetCursor(new_cursor); 60 (*i)->SetCursor(new_cursor);
61 } 61 }
62 } 62 }
63 63
64 void DesktopNativeCursorManager::SetVisibility( 64 void DesktopNativeCursorManager::SetVisibility(
65 bool visible, 65 bool visible,
66 views::corewm::NativeCursorManagerDelegate* delegate) { 66 wm::NativeCursorManagerDelegate* delegate) {
67 delegate->CommitVisibility(visible); 67 delegate->CommitVisibility(visible);
68 68
69 if (visible) { 69 if (visible) {
70 SetCursor(delegate->GetCursor(), delegate); 70 SetCursor(delegate->GetCursor(), delegate);
71 } else { 71 } else {
72 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 72 gfx::NativeCursor invisible_cursor(ui::kCursorNone);
73 cursor_loader_->SetPlatformCursor(&invisible_cursor); 73 cursor_loader_->SetPlatformCursor(&invisible_cursor);
74 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 74 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
75 (*i)->SetCursor(invisible_cursor); 75 (*i)->SetCursor(invisible_cursor);
76 } 76 }
77 77
78 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 78 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
79 (*i)->OnCursorVisibilityChanged(visible); 79 (*i)->OnCursorVisibilityChanged(visible);
80 } 80 }
81 81
82 void DesktopNativeCursorManager::SetCursorSet( 82 void DesktopNativeCursorManager::SetCursorSet(
83 ui::CursorSetType cursor_set, 83 ui::CursorSetType cursor_set,
84 views::corewm::NativeCursorManagerDelegate* delegate) { 84 wm::NativeCursorManagerDelegate* delegate) {
85 NOTIMPLEMENTED(); 85 NOTIMPLEMENTED();
86 } 86 }
87 87
88 void DesktopNativeCursorManager::SetScale( 88 void DesktopNativeCursorManager::SetScale(
89 float scale, 89 float scale,
90 views::corewm::NativeCursorManagerDelegate* delegate) { 90 wm::NativeCursorManagerDelegate* delegate) {
91 NOTIMPLEMENTED(); 91 NOTIMPLEMENTED();
92 } 92 }
93 93
94 void DesktopNativeCursorManager::SetMouseEventsEnabled( 94 void DesktopNativeCursorManager::SetMouseEventsEnabled(
95 bool enabled, 95 bool enabled,
96 views::corewm::NativeCursorManagerDelegate* delegate) { 96 wm::NativeCursorManagerDelegate* delegate) {
97 delegate->CommitMouseEventsEnabled(enabled); 97 delegate->CommitMouseEventsEnabled(enabled);
98 98
99 // TODO(erg): In the ash version, we set the last mouse location on Env. I'm 99 // TODO(erg): In the ash version, we set the last mouse location on Env. I'm
100 // not sure this concept makes sense on the desktop. 100 // not sure this concept makes sense on the desktop.
101 101
102 SetVisibility(delegate->IsCursorVisible(), delegate); 102 SetVisibility(delegate->IsCursorVisible(), delegate);
103 103
104 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) 104 for (Hosts::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i)
105 (*i)->dispatcher()->OnMouseEventsEnableStateChanged(enabled); 105 (*i)->dispatcher()->OnMouseEventsEnableStateChanged(enabled);
106 } 106 }
107 107
108 } // namespace views 108 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698