| 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 calls_to_set_cursor_(0), |
| 16 root_window_(root_window) { | 17 root_window_(root_window) { |
| 17 client::SetCursorClient(root_window, this); | 18 client::SetCursorClient(root_window, this); |
| 18 } | 19 } |
| 19 | 20 |
| 20 TestCursorClient::~TestCursorClient() { | 21 TestCursorClient::~TestCursorClient() { |
| 21 client::SetCursorClient(root_window_, NULL); | 22 client::SetCursorClient(root_window_, NULL); |
| 22 } | 23 } |
| 23 | 24 |
| 24 void TestCursorClient::SetCursor(gfx::NativeCursor cursor) { | 25 void TestCursorClient::SetCursor(gfx::NativeCursor cursor) { |
| 26 calls_to_set_cursor_++; |
| 25 } | 27 } |
| 26 | 28 |
| 27 gfx::NativeCursor TestCursorClient::GetCursor() const { | 29 gfx::NativeCursor TestCursorClient::GetCursor() const { |
| 28 return ui::kCursorNull; | 30 return ui::kCursorNull; |
| 29 } | 31 } |
| 30 | 32 |
| 31 void TestCursorClient::ShowCursor() { | 33 void TestCursorClient::ShowCursor() { |
| 32 visible_ = true; | 34 visible_ = true; |
| 33 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, | 35 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, |
| 34 OnCursorVisibilityChanged(true)); | 36 OnCursorVisibilityChanged(true)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 observers_.AddObserver(observer); | 94 observers_.AddObserver(observer); |
| 93 } | 95 } |
| 94 | 96 |
| 95 void TestCursorClient::RemoveObserver( | 97 void TestCursorClient::RemoveObserver( |
| 96 aura::client::CursorClientObserver* observer) { | 98 aura::client::CursorClientObserver* observer) { |
| 97 observers_.RemoveObserver(observer); | 99 observers_.RemoveObserver(observer); |
| 98 } | 100 } |
| 99 | 101 |
| 100 } // namespace test | 102 } // namespace test |
| 101 } // namespace aura | 103 } // namespace aura |
| OLD | NEW |