Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/aura/test/test_cursor_client.h" | 5 #include "ui/aura/test/test_cursor_client.h" |
| 6 | 6 |
| 7 #include "ui/aura/client/cursor_client_observer.h" | 7 #include "ui/aura/client/cursor_client_observer.h" |
| 8 | 8 |
| 9 namespace aura { | 9 namespace aura { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 TestCursorClient::TestCursorClient(aura::Window* root_window) | 12 TestCursorClient::TestCursorClient(aura::Window* root_window) |
| 13 : visible_(true), | 13 : visible_(true), |
| 14 mouse_events_enabled_(true), | 14 mouse_events_enabled_(true), |
| 15 cursor_lock_count_(0), | 15 cursor_lock_count_(0), |
| 16 root_window_(root_window) { | 16 root_window_(root_window) { |
| 17 client::SetCursorClient(root_window, this); | 17 client::SetCursorClient(root_window, this); |
| 18 } | 18 } |
| 19 | 19 |
| 20 TestCursorClient::~TestCursorClient() { | 20 TestCursorClient::~TestCursorClient() { |
| 21 client::SetCursorClient(root_window_, NULL); | 21 client::SetCursorClient(root_window_, NULL); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void TestCursorClient::SetCursor(gfx::NativeCursor cursor) { | 24 void TestCursorClient::SetCursor(gfx::NativeCursor cursor) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 gfx::NativeCursor TestCursorClient::GetCursor() const { | |
| 28 return ui::kCursorNull; | |
| 29 } | |
| 30 | |
| 27 void TestCursorClient::ShowCursor() { | 31 void TestCursorClient::ShowCursor() { |
| 28 visible_ = true; | 32 visible_ = true; |
| 29 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, | 33 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, |
| 30 OnCursorVisibilityChanged(true)); | 34 OnCursorVisibilityChanged(true)); |
| 31 } | 35 } |
| 32 | 36 |
| 33 void TestCursorClient::HideCursor() { | 37 void TestCursorClient::HideCursor() { |
| 34 visible_ = false; | 38 visible_ = false; |
| 35 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, | 39 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, |
| 36 OnCursorVisibilityChanged(false)); | 40 OnCursorVisibilityChanged(false)); |
| 37 } | 41 } |
| 38 | 42 |
| 39 void TestCursorClient::SetCursorSet(ui::CursorSetType cursor_set) { | 43 void TestCursorClient::SetCursorSet(ui::CursorSetType cursor_set) { |
| 40 } | 44 } |
| 41 | 45 |
| 46 ui::CursorSetType TestCursorClient::GetCursorSet() const { | |
| 47 return ui::CURSOR_SET_NORMAL; | |
| 48 } | |
| 49 | |
| 42 void TestCursorClient::SetScale(float scale) { | 50 void TestCursorClient::SetScale(float scale) { |
| 43 } | 51 } |
| 44 | 52 |
| 53 float TestCursorClient::GetScale() const { | |
| 54 return 0.f; | |
|
sky
2013/12/05 01:32:43
Don't we want 1 here?
tdanderson
2013/12/05 23:07:41
Done.
| |
| 55 } | |
| 56 | |
| 45 bool TestCursorClient::IsCursorVisible() const { | 57 bool TestCursorClient::IsCursorVisible() const { |
| 46 return visible_; | 58 return visible_; |
| 47 } | 59 } |
| 48 | 60 |
| 49 void TestCursorClient::EnableMouseEvents() { | 61 void TestCursorClient::EnableMouseEvents() { |
| 50 mouse_events_enabled_ = true; | 62 mouse_events_enabled_ = true; |
| 51 } | 63 } |
| 52 | 64 |
| 53 void TestCursorClient::DisableMouseEvents() { | 65 void TestCursorClient::DisableMouseEvents() { |
| 54 mouse_events_enabled_ = false; | 66 mouse_events_enabled_ = false; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 80 observers_.AddObserver(observer); | 92 observers_.AddObserver(observer); |
| 81 } | 93 } |
| 82 | 94 |
| 83 void TestCursorClient::RemoveObserver( | 95 void TestCursorClient::RemoveObserver( |
| 84 aura::client::CursorClientObserver* observer) { | 96 aura::client::CursorClientObserver* observer) { |
| 85 observers_.RemoveObserver(observer); | 97 observers_.RemoveObserver(observer); |
| 86 } | 98 } |
| 87 | 99 |
| 88 } // namespace test | 100 } // namespace test |
| 89 } // namespace aura | 101 } // namespace aura |
| OLD | NEW |