Skip to content

Commit

Permalink
Remove obsolete scale related APIs for cursor
Browse files Browse the repository at this point in the history
This has been replaced with SetDisplay a while ago.

BUG=None

Review URL: https://codereview.chromium.org/233053003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263043 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
oshima@chromium.org committed Apr 10, 2014
1 parent 6fff46c commit 30be97b
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 96 deletions.
4 changes: 0 additions & 4 deletions ash/test/cursor_manager_test_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ CursorManagerTestApi::~CursorManagerTestApi() {
}

// TODO(tdanderson): CursorManagerTestApi may no longer be needed.
float CursorManagerTestApi::GetCurrentScale() const {
return cursor_manager_->GetScale();
}

ui::CursorSetType CursorManagerTestApi::GetCurrentCursorSet() const {
return cursor_manager_->GetCursorSet();
}
Expand Down
1 change: 0 additions & 1 deletion ash/test/cursor_manager_test_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class CursorManagerTestApi {
explicit CursorManagerTestApi(::wm::CursorManager* cursor_manager);
~CursorManagerTestApi();

float GetCurrentScale() const;
ui::CursorSetType GetCurrentCursorSet() const;
gfx::NativeCursor GetCurrentCursor() const;
gfx::Display GetDisplay() const;
Expand Down
10 changes: 0 additions & 10 deletions ash/wm/ash_native_cursor_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,6 @@ void AshNativeCursorManager::SetCursorSet(
#endif
}

void AshNativeCursorManager::SetScale(
float scale,
::wm::NativeCursorManagerDelegate* delegate) {
image_cursors_->SetScale(scale);
delegate->CommitScale(scale);

// Sets the cursor to reflect the scale change immediately.
SetCursor(delegate->GetCursor(), delegate);
}

void AshNativeCursorManager::SetVisibility(
bool visible,
::wm::NativeCursorManagerDelegate* delegate) {
Expand Down
3 changes: 0 additions & 3 deletions ash/wm/ash_native_cursor_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ class ASH_EXPORT AshNativeCursorManager
virtual void SetVisibility(
bool visible,
::wm::NativeCursorManagerDelegate* delegate) OVERRIDE;
virtual void SetScale(
float scale,
::wm::NativeCursorManagerDelegate* delegate) OVERRIDE;
virtual void SetCursorSet(
ui::CursorSetType cursor_set,
::wm::NativeCursorManagerDelegate* delegate) OVERRIDE;
Expand Down
23 changes: 0 additions & 23 deletions ash/wm/ash_native_cursor_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ TEST_F(AshNativeCursorManagerTest, LockCursor) {
EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
display.set_device_scale_factor(2.0f);
display.set_rotation(gfx::Display::ROTATE_90);
cursor_manager->SetScale(2.5f);
cursor_manager->SetDisplay(display);
EXPECT_EQ(2.5f, test_api.GetCurrentScale());
EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor());
EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet());
EXPECT_EQ(gfx::Display::ROTATE_90, test_api.GetDisplay().rotation());
Expand All @@ -82,13 +80,6 @@ TEST_F(AshNativeCursorManagerTest, LockCursor) {
cursor_manager->SetCursorSet(ui::CURSOR_SET_NORMAL);
EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet());

// Cusror scale does change even while cursor is locked.
EXPECT_EQ(2.5f, test_api.GetCurrentScale());
cursor_manager->SetScale(1.f);
EXPECT_EQ(1.f, test_api.GetCurrentScale());
cursor_manager->SetScale(1.5f);
EXPECT_EQ(1.5f, test_api.GetCurrentScale());

// Cursor type does not change while cursor is locked.
cursor_manager->SetCursor(ui::kCursorPointer);
EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type());
Expand All @@ -104,7 +95,6 @@ TEST_F(AshNativeCursorManagerTest, LockCursor) {
EXPECT_FALSE(cursor_manager->IsCursorLocked());

// Cursor type changes to the one specified while cursor is locked.
EXPECT_EQ(1.5f, test_api.GetCurrentScale());
EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type());
EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor());
EXPECT_TRUE(test_api.GetCurrentCursor().platform());
Expand Down Expand Up @@ -140,19 +130,6 @@ TEST_F(AshNativeCursorManagerTest, SetCursorSet) {
EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet());
}

TEST_F(AshNativeCursorManagerTest, SetScale) {
::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
CursorManagerTestApi test_api(cursor_manager);

EXPECT_EQ(1.f, test_api.GetCurrentScale());

cursor_manager->SetScale(2.5f);
EXPECT_EQ(2.5f, test_api.GetCurrentScale());

cursor_manager->SetScale(1.f);
EXPECT_EQ(1.f, test_api.GetCurrentScale());
}

TEST_F(AshNativeCursorManagerTest, SetDeviceScaleFactorAndRotation) {
::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
CursorManagerTestApi test_api(cursor_manager);
Expand Down
6 changes: 0 additions & 6 deletions ui/aura/client/cursor_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ class AURA_EXPORT CursorClient {
// invisible.
virtual void HideCursor() = 0;

// Sets the scale of the mouse cursor icon.
virtual void SetScale(float scale) = 0;

// Gets the current scale of the mouse cursor icon.
virtual float GetScale() const = 0;

// Sets the type of the mouse cursor icon.
virtual void SetCursorSet(ui::CursorSetType cursor_set) = 0;

Expand Down
7 changes: 0 additions & 7 deletions ui/aura/test/test_cursor_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ ui::CursorSetType TestCursorClient::GetCursorSet() const {
return ui::CURSOR_SET_NORMAL;
}

void TestCursorClient::SetScale(float scale) {
}

float TestCursorClient::GetScale() const {
return 1.f;
}

bool TestCursorClient::IsCursorVisible() const {
return visible_;
}
Expand Down
2 changes: 0 additions & 2 deletions ui/aura/test/test_cursor_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class TestCursorClient : public aura::client::CursorClient {
virtual void HideCursor() OVERRIDE;
virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE;
virtual ui::CursorSetType GetCursorSet() const OVERRIDE;
virtual void SetScale(float scale) OVERRIDE;
virtual float GetScale() const OVERRIDE;
virtual bool IsCursorVisible() const OVERRIDE;
virtual void EnableMouseEvents() OVERRIDE;
virtual void DisableMouseEvents() OVERRIDE;
Expand Down
6 changes: 0 additions & 6 deletions ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ void DesktopNativeCursorManager::SetCursorSet(
NOTIMPLEMENTED();
}

void DesktopNativeCursorManager::SetScale(
float scale,
wm::NativeCursorManagerDelegate* delegate) {
NOTIMPLEMENTED();
}

void DesktopNativeCursorManager::SetMouseEventsEnabled(
bool enabled,
wm::NativeCursorManagerDelegate* delegate) {
Expand Down
3 changes: 0 additions & 3 deletions ui/views/widget/desktop_aura/desktop_native_cursor_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ class VIEWS_EXPORT DesktopNativeCursorManager
virtual void SetCursorSet(
ui::CursorSetType cursor_set,
wm::NativeCursorManagerDelegate* delegate) OVERRIDE;
virtual void SetScale(
float scale,
wm::NativeCursorManagerDelegate* delegate) OVERRIDE;
virtual void SetMouseEventsEnabled(
bool enabled,
wm::NativeCursorManagerDelegate* delegate) OVERRIDE;
Expand Down
21 changes: 0 additions & 21 deletions ui/wm/core/cursor_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class CursorState {
CursorState()
: cursor_(ui::kCursorNone),
visible_(true),
scale_(1.f),
cursor_set_(ui::CURSOR_SET_NORMAL),
mouse_events_enabled_(true),
visible_on_mouse_events_enabled_(true) {
Expand All @@ -37,11 +36,6 @@ class CursorState {
// Ignores the call when mouse events disabled.
}

float scale() const { return scale_; }
void set_scale(float scale) {
scale_ = scale;
}

ui::CursorSetType cursor_set() const { return cursor_set_; }
void set_cursor_set(ui::CursorSetType cursor_set) {
cursor_set_ = cursor_set;
Expand All @@ -65,7 +59,6 @@ class CursorState {
private:
gfx::NativeCursor cursor_;
bool visible_;
float scale_;
ui::CursorSetType cursor_set_;
bool mouse_events_enabled_;

Expand Down Expand Up @@ -123,16 +116,6 @@ bool CursorManager::IsCursorVisible() const {
return current_state_->visible();
}

void CursorManager::SetScale(float scale) {
state_on_unlock_->set_scale(scale);
if (GetScale() != state_on_unlock_->scale())
delegate_->SetScale(state_on_unlock_->scale(), this);
}

float CursorManager::GetScale() const {
return current_state_->scale();
}

void CursorManager::SetCursorSet(ui::CursorSetType cursor_set) {
state_on_unlock_->set_cursor_set(cursor_set);
if (GetCursorSet() != state_on_unlock_->cursor_set())
Expand Down Expand Up @@ -223,10 +206,6 @@ void CursorManager::CommitVisibility(bool visible) {
current_state_->SetVisible(visible);
}

void CursorManager::CommitScale(float scale) {
current_state_->set_scale(scale);
}

void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) {
current_state_->set_cursor_set(cursor_set);
}
Expand Down
3 changes: 0 additions & 3 deletions ui/wm/core/cursor_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class WM_CORE_EXPORT CursorManager : public aura::client::CursorClient,
virtual void ShowCursor() OVERRIDE;
virtual void HideCursor() OVERRIDE;
virtual bool IsCursorVisible() const OVERRIDE;
virtual void SetScale(float scale) OVERRIDE;
virtual float GetScale() const OVERRIDE;
virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE;
virtual ui::CursorSetType GetCursorSet() const OVERRIDE;
virtual void EnableMouseEvents() OVERRIDE;
Expand All @@ -70,7 +68,6 @@ class WM_CORE_EXPORT CursorManager : public aura::client::CursorClient,
// Overridden from NativeCursorManagerDelegate:
virtual void CommitCursor(gfx::NativeCursor cursor) OVERRIDE;
virtual void CommitVisibility(bool visible) OVERRIDE;
virtual void CommitScale(float scale) OVERRIDE;
virtual void CommitCursorSet(ui::CursorSetType cursor_set) OVERRIDE;
virtual void CommitMouseEventsEnabled(bool enabled) OVERRIDE;

Expand Down
7 changes: 1 addition & 6 deletions ui/wm/core/native_cursor_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ class WM_CORE_EXPORT NativeCursorManager {
bool visible,
wm::NativeCursorManagerDelegate* delegate) = 0;

// A request to set the scale of the cursor icon.
virtual void SetScale(
float scale,
wm::NativeCursorManagerDelegate* delegate) = 0;

// A request to set the scale of the cursor icon.
// A request to set the cursor set.
virtual void SetCursorSet(
ui::CursorSetType cursor_set,
wm::NativeCursorManagerDelegate* delegate) = 0;
Expand Down
1 change: 0 additions & 1 deletion ui/wm/core/native_cursor_manager_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class WM_CORE_EXPORT NativeCursorManagerDelegate {

virtual void CommitCursor(gfx::NativeCursor cursor) = 0;
virtual void CommitVisibility(bool visible) = 0;
virtual void CommitScale(float scale) = 0;
virtual void CommitCursorSet(ui::CursorSetType cursor_set) = 0;
virtual void CommitMouseEventsEnabled(bool enabled) = 0;
};
Expand Down

0 comments on commit 30be97b

Please sign in to comment.