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

Side by Side Diff: ui/aura/test/test_cursor_client.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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 | « ui/aura/test/test_cursor_client.h ('k') | ui/aura/test/test_focus_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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/aura/test/test_cursor_client.h"
6
7 #include "ui/aura/client/cursor_client_observer.h"
8
9 namespace aura {
10 namespace test {
11
12 TestCursorClient::TestCursorClient(aura::Window* root_window)
13 : visible_(true),
14 should_hide_cursor_on_key_event_(true),
15 mouse_events_enabled_(true),
16 cursor_lock_count_(0),
17 calls_to_set_cursor_(0),
18 root_window_(root_window) {
19 client::SetCursorClient(root_window, this);
20 }
21
22 TestCursorClient::~TestCursorClient() {
23 client::SetCursorClient(root_window_, NULL);
24 }
25
26 void TestCursorClient::SetCursor(gfx::NativeCursor cursor) {
27 calls_to_set_cursor_++;
28 }
29
30 gfx::NativeCursor TestCursorClient::GetCursor() const {
31 return ui::kCursorNull;
32 }
33
34 void TestCursorClient::ShowCursor() {
35 visible_ = true;
36 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_,
37 OnCursorVisibilityChanged(true));
38 }
39
40 void TestCursorClient::HideCursor() {
41 visible_ = false;
42 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_,
43 OnCursorVisibilityChanged(false));
44 }
45
46 void TestCursorClient::SetCursorSet(ui::CursorSetType cursor_set) {
47 }
48
49 ui::CursorSetType TestCursorClient::GetCursorSet() const {
50 return ui::CURSOR_SET_NORMAL;
51 }
52
53 bool TestCursorClient::IsCursorVisible() const {
54 return visible_;
55 }
56
57 void TestCursorClient::EnableMouseEvents() {
58 mouse_events_enabled_ = true;
59 }
60
61 void TestCursorClient::DisableMouseEvents() {
62 mouse_events_enabled_ = false;
63 }
64
65 bool TestCursorClient::IsMouseEventsEnabled() const {
66 return mouse_events_enabled_;
67 }
68
69 void TestCursorClient::SetDisplay(const gfx::Display& display) {
70 }
71
72 void TestCursorClient::LockCursor() {
73 cursor_lock_count_++;
74 }
75
76 void TestCursorClient::UnlockCursor() {
77 cursor_lock_count_--;
78 if (cursor_lock_count_ < 0)
79 cursor_lock_count_ = 0;
80 }
81
82 bool TestCursorClient::IsCursorLocked() const {
83 return cursor_lock_count_ > 0;
84 }
85
86 void TestCursorClient::AddObserver(
87 aura::client::CursorClientObserver* observer) {
88 observers_.AddObserver(observer);
89 }
90
91 void TestCursorClient::RemoveObserver(
92 aura::client::CursorClientObserver* observer) {
93 observers_.RemoveObserver(observer);
94 }
95
96 bool TestCursorClient::ShouldHideCursorOnKeyEvent(
97 const ui::KeyEvent& event) const {
98 return should_hide_cursor_on_key_event_;
99 }
100
101 } // namespace test
102 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/test_cursor_client.h ('k') | ui/aura/test/test_focus_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698