OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/views/widget/desktop_aura/desktop_cursor_client.h" | |
6 | |
7 #include "ui/aura/root_window.h" | |
8 #include "ui/base/cursor/cursor_loader.h" | |
9 | |
10 namespace views { | |
11 | |
12 DesktopCursorClient::DesktopCursorClient(aura::RootWindow* window) | |
13 : root_window_(window), | |
14 cursor_loader_(ui::CursorLoader::Create()), | |
15 current_cursor_(ui::kCursorNone), | |
16 cursor_visible_(true) { | |
17 } | |
18 | |
19 DesktopCursorClient::~DesktopCursorClient() { | |
20 } | |
21 | |
22 void DesktopCursorClient::SetCursor(gfx::NativeCursor cursor) { | |
23 current_cursor_ = cursor; | |
24 cursor_loader_->SetPlatformCursor(¤t_cursor_); | |
25 if (cursor_visible_) | |
26 root_window_->SetCursor(current_cursor_); | |
27 } | |
28 | |
29 void DesktopCursorClient::ShowCursor() { | |
30 SetCursorVisibility(true); | |
31 } | |
32 | |
33 void DesktopCursorClient::HideCursor() { | |
34 SetCursorVisibility(false); | |
35 } | |
36 | |
37 bool DesktopCursorClient::IsCursorVisible() const { | |
38 return cursor_visible_; | |
39 } | |
40 | |
41 void DesktopCursorClient::EnableMouseEvents() { | |
42 // TODO(mazda): Implement this. | |
43 NOTIMPLEMENTED(); | |
44 } | |
45 | |
46 void DesktopCursorClient::DisableMouseEvents() { | |
47 // TODO(mazda): Implement this. | |
48 NOTIMPLEMENTED(); | |
49 } | |
50 | |
51 bool DesktopCursorClient::IsMouseEventsEnabled() const { | |
52 // TODO(mazda): Implement this. | |
53 NOTIMPLEMENTED(); | |
54 return true; | |
55 } | |
56 | |
57 void DesktopCursorClient::SetDeviceScaleFactor(float device_scale_factor) { | |
58 cursor_loader_->UnloadAll(); | |
59 cursor_loader_->set_device_scale_factor(device_scale_factor); | |
60 } | |
61 | |
62 void DesktopCursorClient::LockCursor() { | |
63 // TODO(mazda): Implement this. | |
64 NOTIMPLEMENTED(); | |
65 } | |
66 | |
67 void DesktopCursorClient::UnlockCursor() { | |
68 // TODO(mazda): Implement this. | |
69 NOTIMPLEMENTED(); | |
70 } | |
71 | |
72 void DesktopCursorClient::SetCursorVisibility(bool visible) { | |
73 if (cursor_visible_ == visible) | |
74 return; | |
75 cursor_visible_ = visible; | |
76 root_window_->SetCursor(current_cursor_); | |
77 root_window_->OnCursorVisibilityChanged(visible); | |
78 } | |
79 | |
80 } // namespace views | |
OLD | NEW |