Commit 79e1ed69 authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Collapse NativeCursorManagerAsh with its only subclass

NativeCursorManagerAshClassic is the only subclass.

I'm going to rename the file in a follow-up CL to help git rename
tracking preserve the blame history.

Bug: 866532
Change-Id: Icb4a0ee7211a4256d6655797393d22bb43169e77
Reviewed-on: https://chromium-review.googlesource.com/1212143Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589526}
parent 91189edf
......@@ -1143,7 +1143,6 @@ component("ash") {
"wm/lock_window_state.cc",
"wm/lock_window_state.h",
"wm/mru_window_tracker.cc",
"wm/native_cursor_manager_ash.h",
"wm/native_cursor_manager_ash_classic.cc",
"wm/native_cursor_manager_ash_classic.h",
"wm/non_client_frame_controller.cc",
......
......@@ -1046,7 +1046,7 @@ void Shell::Init(
window_positioner_ = std::make_unique<WindowPositioner>();
native_cursor_manager_ = new NativeCursorManagerAshClassic;
native_cursor_manager_ = new NativeCursorManagerAsh;
cursor_manager_ =
std::make_unique<CursorManager>(base::WrapUnique(native_cursor_manager_));
......
......@@ -6,7 +6,7 @@
#include "ash/shell.h"
#include "ash/shell_test_api.h"
#include "ash/wm/native_cursor_manager_ash.h"
#include "ash/wm/native_cursor_manager_ash_classic.h"
#include "ui/base/cursor/image_cursors.h"
#include "ui/display/display.h"
#include "ui/wm/core/cursor_manager.h"
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
#define ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
#include "ash/ash_export.h"
#include "base/macros.h"
#include "ui/display/display.h"
#include "ui/wm/core/native_cursor_manager.h"
#include "ui/wm/core/native_cursor_manager_delegate.h"
namespace ash {
// Ash specific extensions to NativeCursorManager. This lets us switch whether
// we're using the native cursor, along with exposing additional data about how
// we're going to render cursors.
// TODO(jamescook): If we don't end up with a mash implementation of this
// interface then collapse it with NativeCursorManagerAshClassic, which is the
// only subclass.
class ASH_EXPORT NativeCursorManagerAsh : public ::wm::NativeCursorManager {
public:
~NativeCursorManagerAsh() override = default;
// Toggle native cursor enabled/disabled.
// The native cursor is enabled by default. When disabled, we hide the native
// cursor regardless of visibility state, and let CursorWindowManager draw
// the cursor.
virtual void SetNativeCursorEnabled(bool enabled) = 0;
// Returns the scale and rotation of the currently loaded cursor.
virtual float GetScale() const = 0;
virtual display::Display::Rotation GetRotation() const = 0;
protected:
NativeCursorManagerAsh() = default;
private:
DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerAsh);
};
} // namespace ash
#endif // ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
......@@ -14,6 +14,7 @@
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/image_cursors.h"
#include "ui/base/layout.h"
#include "ui/wm/core/native_cursor_manager_delegate.h"
namespace ash {
namespace {
......@@ -52,27 +53,27 @@ void NotifyMouseEventsEnableStateChange(bool enabled) {
} // namespace
NativeCursorManagerAshClassic::NativeCursorManagerAshClassic()
NativeCursorManagerAsh::NativeCursorManagerAsh()
: native_cursor_enabled_(true), image_cursors_(new ui::ImageCursors) {}
NativeCursorManagerAshClassic::~NativeCursorManagerAshClassic() = default;
NativeCursorManagerAsh::~NativeCursorManagerAsh() = default;
void NativeCursorManagerAshClassic::SetNativeCursorEnabled(bool enabled) {
void NativeCursorManagerAsh::SetNativeCursorEnabled(bool enabled) {
native_cursor_enabled_ = enabled;
::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager();
SetCursor(cursor_manager->GetCursor(), cursor_manager);
}
float NativeCursorManagerAshClassic::GetScale() const {
float NativeCursorManagerAsh::GetScale() const {
return image_cursors_->GetScale();
}
display::Display::Rotation NativeCursorManagerAshClassic::GetRotation() const {
display::Display::Rotation NativeCursorManagerAsh::GetRotation() const {
return image_cursors_->GetRotation();
}
void NativeCursorManagerAshClassic::SetDisplay(
void NativeCursorManagerAsh::SetDisplay(
const display::Display& display,
::wm::NativeCursorManagerDelegate* delegate) {
DCHECK(display.is_valid());
......@@ -95,7 +96,7 @@ void NativeCursorManagerAshClassic::SetDisplay(
->SetDisplay(display);
}
void NativeCursorManagerAshClassic::SetCursor(
void NativeCursorManagerAsh::SetCursor(
gfx::NativeCursor cursor,
::wm::NativeCursorManagerDelegate* delegate) {
if (native_cursor_enabled_) {
......@@ -113,7 +114,7 @@ void NativeCursorManagerAshClassic::SetCursor(
SetCursorOnAllRootWindows(cursor);
}
void NativeCursorManagerAshClassic::SetCursorSize(
void NativeCursorManagerAsh::SetCursorSize(
ui::CursorSize cursor_size,
::wm::NativeCursorManagerDelegate* delegate) {
image_cursors_->SetCursorSize(cursor_size);
......@@ -129,7 +130,7 @@ void NativeCursorManagerAshClassic::SetCursorSize(
->SetCursorSize(cursor_size);
}
void NativeCursorManagerAshClassic::SetVisibility(
void NativeCursorManagerAsh::SetVisibility(
bool visible,
::wm::NativeCursorManagerDelegate* delegate) {
delegate->CommitVisibility(visible);
......@@ -145,7 +146,7 @@ void NativeCursorManagerAshClassic::SetVisibility(
NotifyCursorVisibilityChange(visible);
}
void NativeCursorManagerAshClassic::SetMouseEventsEnabled(
void NativeCursorManagerAsh::SetMouseEventsEnabled(
bool enabled,
::wm::NativeCursorManagerDelegate* delegate) {
delegate->CommitMouseEventsEnabled(enabled);
......
......@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_NATIVE_CURSOR_MANAGER_ASH_CLASSIC_H_
#define ASH_WM_NATIVE_CURSOR_MANAGER_ASH_CLASSIC_H_
#ifndef ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
#define ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
#include "ash/wm/native_cursor_manager_ash.h"
#include "ash/ash_export.h"
#include "base/macros.h"
#include "ui/display/display.h"
#include "ui/wm/core/native_cursor_manager.h"
namespace ui {
class ImageCursors;
......@@ -17,18 +20,20 @@ namespace ash {
// visibility. It communicates back with the CursorManager through the
// NativeCursorManagerDelegate interface, which receives messages about what
// changes were acted on.
class ASH_EXPORT NativeCursorManagerAshClassic : public NativeCursorManagerAsh {
class ASH_EXPORT NativeCursorManagerAsh : public ::wm::NativeCursorManager {
public:
NativeCursorManagerAshClassic();
~NativeCursorManagerAshClassic() override;
NativeCursorManagerAsh();
~NativeCursorManagerAsh() override;
private:
friend class CursorManagerTestApi;
// Toggle native cursor enabled/disabled.
// The native cursor is enabled by default. When disabled, we hide the native
// cursor regardless of visibility state, and let CursorWindowManager draw
// the cursor.
void SetNativeCursorEnabled(bool enabled);
// Overridden from NativeCursorManagerAsh:
void SetNativeCursorEnabled(bool enabled) override;
float GetScale() const override;
display::Display::Rotation GetRotation() const override;
// Returns the scale and rotation of the currently loaded cursor.
float GetScale() const;
display::Display::Rotation GetRotation() const;
// Overridden from ::wm::NativeCursorManager:
void SetDisplay(const display::Display& display,
......@@ -43,6 +48,9 @@ class ASH_EXPORT NativeCursorManagerAshClassic : public NativeCursorManagerAsh {
bool enabled,
::wm::NativeCursorManagerDelegate* delegate) override;
private:
friend class CursorManagerTestApi;
// The cursor location where the cursor was disabled.
gfx::Point disabled_cursor_location_;
......@@ -50,9 +58,9 @@ class ASH_EXPORT NativeCursorManagerAshClassic : public NativeCursorManagerAsh {
std::unique_ptr<ui::ImageCursors> image_cursors_;
DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerAshClassic);
DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerAsh);
};
} // namespace ash
#endif // ASH_WM_NATIVE_CURSOR_MANAGER_ASH_CLASSIC_H_
#endif // ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/native_cursor_manager_ash.h"
#include "ash/wm/native_cursor_manager_ash_classic.h"
#include "ash/shell.h"
#include "ash/test/ash_interactive_ui_test_base.h"
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/native_cursor_manager_ash.h"
#include "ash/wm/native_cursor_manager_ash_classic.h"
#include "ash/display/display_util.h"
#include "ash/shell.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment