Remove ExtensionPrefs::SetDidExtensionEscalatePermissions.
[chromium-blink-merge.git] / ui / aura / test / test_cursor_client.cc
blobef1eba210eeaecc05d6a1b6d6c3520c406717103
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.
5 #include "ui/aura/test/test_cursor_client.h"
7 #include "ui/aura/client/cursor_client_observer.h"
9 namespace aura {
10 namespace test {
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);
22 TestCursorClient::~TestCursorClient() {
23 client::SetCursorClient(root_window_, NULL);
26 void TestCursorClient::SetCursor(gfx::NativeCursor cursor) {
27 calls_to_set_cursor_++;
30 gfx::NativeCursor TestCursorClient::GetCursor() const {
31 return ui::kCursorNull;
34 void TestCursorClient::ShowCursor() {
35 visible_ = true;
36 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_,
37 OnCursorVisibilityChanged(true));
40 void TestCursorClient::HideCursor() {
41 visible_ = false;
42 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_,
43 OnCursorVisibilityChanged(false));
46 void TestCursorClient::SetCursorSet(ui::CursorSetType cursor_set) {
49 ui::CursorSetType TestCursorClient::GetCursorSet() const {
50 return ui::CURSOR_SET_NORMAL;
53 bool TestCursorClient::IsCursorVisible() const {
54 return visible_;
57 void TestCursorClient::EnableMouseEvents() {
58 mouse_events_enabled_ = true;
61 void TestCursorClient::DisableMouseEvents() {
62 mouse_events_enabled_ = false;
65 bool TestCursorClient::IsMouseEventsEnabled() const {
66 return mouse_events_enabled_;
69 void TestCursorClient::SetDisplay(const gfx::Display& display) {
72 void TestCursorClient::LockCursor() {
73 cursor_lock_count_++;
76 void TestCursorClient::UnlockCursor() {
77 cursor_lock_count_--;
78 if (cursor_lock_count_ < 0)
79 cursor_lock_count_ = 0;
82 bool TestCursorClient::IsCursorLocked() const {
83 return cursor_lock_count_ > 0;
86 void TestCursorClient::AddObserver(
87 aura::client::CursorClientObserver* observer) {
88 observers_.AddObserver(observer);
91 void TestCursorClient::RemoveObserver(
92 aura::client::CursorClientObserver* observer) {
93 observers_.RemoveObserver(observer);
96 bool TestCursorClient::ShouldHideCursorOnKeyEvent(
97 const ui::KeyEvent& event) const {
98 return should_hide_cursor_on_key_event_;
101 } // namespace test
102 } // namespace aura