Commit 11127567 authored by spang's avatar spang Committed by Commit bot

ozone: Remove CursorFactoryOzone::SetCursor, GetCursorWindow

Use PlatformWindow::SetCursor instead of CursorFactoryOzone::SetCursor.
The GetCursorWindow() function becomes an implementation detail of the
DRI platform.

BUG=none
TEST=compile, run on cros link_freon
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#293033}
parent 7c403e06
...@@ -26,6 +26,12 @@ BitmapCursorFactoryOzone::BitmapCursorFactoryOzone() {} ...@@ -26,6 +26,12 @@ BitmapCursorFactoryOzone::BitmapCursorFactoryOzone() {}
BitmapCursorFactoryOzone::~BitmapCursorFactoryOzone() {} BitmapCursorFactoryOzone::~BitmapCursorFactoryOzone() {}
// static
scoped_refptr<BitmapCursorOzone> BitmapCursorFactoryOzone::GetBitmapCursor(
PlatformCursor platform_cursor) {
return make_scoped_refptr(ToBitmapCursorOzone(platform_cursor));
}
PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(int type) { PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(int type) {
if (type == kCursorNone) if (type == kCursorNone)
return NULL; // NULL is used for hidden cursor. return NULL; // NULL is used for hidden cursor.
...@@ -58,16 +64,4 @@ void BitmapCursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) { ...@@ -58,16 +64,4 @@ void BitmapCursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) {
ToBitmapCursorOzone(cursor)->Release(); ToBitmapCursorOzone(cursor)->Release();
} }
void BitmapCursorFactoryOzone::SetCursor(gfx::AcceleratedWidget widget,
PlatformCursor platform_cursor) {
BitmapCursorOzone* cursor = ToBitmapCursorOzone(platform_cursor);
SetBitmapCursor(widget, make_scoped_refptr(cursor));
}
void BitmapCursorFactoryOzone::SetBitmapCursor(
gfx::AcceleratedWidget widget,
scoped_refptr<BitmapCursorOzone>) {
NOTIMPLEMENTED();
}
} // namespace ui } // namespace ui
...@@ -48,19 +48,16 @@ class UI_BASE_EXPORT BitmapCursorFactoryOzone : public CursorFactoryOzone { ...@@ -48,19 +48,16 @@ class UI_BASE_EXPORT BitmapCursorFactoryOzone : public CursorFactoryOzone {
BitmapCursorFactoryOzone(); BitmapCursorFactoryOzone();
virtual ~BitmapCursorFactoryOzone(); virtual ~BitmapCursorFactoryOzone();
// Convert PlatformCursor to BitmapCursorOzone.
static scoped_refptr<BitmapCursorOzone> GetBitmapCursor(
PlatformCursor platform_cursor);
// CursorFactoryOzone: // CursorFactoryOzone:
virtual PlatformCursor GetDefaultCursor(int type) OVERRIDE; virtual PlatformCursor GetDefaultCursor(int type) OVERRIDE;
virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap, virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap,
const gfx::Point& hotspot) OVERRIDE; const gfx::Point& hotspot) OVERRIDE;
virtual void RefImageCursor(PlatformCursor cursor) OVERRIDE; virtual void RefImageCursor(PlatformCursor cursor) OVERRIDE;
virtual void UnrefImageCursor(PlatformCursor cursor) OVERRIDE; virtual void UnrefImageCursor(PlatformCursor cursor) OVERRIDE;
virtual void SetCursor(gfx::AcceleratedWidget widget,
PlatformCursor cursor) OVERRIDE;
// Set a bitmap cursor for the given window. This must be overridden by
// subclasses. If the cursor is hidden (kCursorNone) then cursor is NULL.
virtual void SetBitmapCursor(gfx::AcceleratedWidget window,
scoped_refptr<BitmapCursorOzone> cursor);
private: private:
// Default cursors are cached & owned by the factory. // Default cursors are cached & owned by the factory.
......
...@@ -19,10 +19,10 @@ source_set("dri_common") { ...@@ -19,10 +19,10 @@ source_set("dri_common") {
"chromeos/native_display_delegate_dri.h", "chromeos/native_display_delegate_dri.h",
"crtc_state.cc", "crtc_state.cc",
"crtc_state.h", "crtc_state.h",
"cursor_factory_evdev_dri.cc",
"cursor_factory_evdev_dri.h",
"dri_console_buffer.cc", "dri_console_buffer.cc",
"dri_console_buffer.h", "dri_console_buffer.h",
"dri_cursor.cc",
"dri_cursor.h",
"dri_buffer.cc", "dri_buffer.cc",
"dri_buffer.h", "dri_buffer.h",
"dri_surface.cc", "dri_surface.cc",
......
...@@ -43,12 +43,12 @@ ...@@ -43,12 +43,12 @@
'chromeos/native_display_delegate_dri.h', 'chromeos/native_display_delegate_dri.h',
'crtc_state.cc', 'crtc_state.cc',
'crtc_state.h', 'crtc_state.h',
'cursor_factory_evdev_dri.cc',
'cursor_factory_evdev_dri.h',
'dri_console_buffer.cc', 'dri_console_buffer.cc',
'dri_console_buffer.h', 'dri_console_buffer.h',
'dri_buffer.cc', 'dri_buffer.cc',
'dri_buffer.h', 'dri_buffer.h',
'dri_cursor.cc',
'dri_cursor.h',
'dri_surface.cc', 'dri_surface.cc',
'dri_surface.h', 'dri_surface.h',
'dri_surface_factory.cc', 'dri_surface_factory.cc',
......
...@@ -2,27 +2,31 @@ ...@@ -2,27 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" #include "ui/ozone/platform/dri/dri_cursor.h"
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h" #include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/ozone/platform/dri/dri_surface_factory.h" #include "ui/ozone/platform/dri/dri_surface_factory.h"
#include "ui/ozone/platform/dri/hardware_cursor_delegate.h" #include "ui/ozone/platform/dri/hardware_cursor_delegate.h"
namespace ui { namespace ui {
CursorFactoryEvdevDri::CursorFactoryEvdevDri(HardwareCursorDelegate* hardware) DriCursor::DriCursor(HardwareCursorDelegate* hardware) : hardware_(hardware) {
: hardware_(hardware) {
// TODO(dnicoara) Assume the first widget since at this point there are no // TODO(dnicoara) Assume the first widget since at this point there are no
// widgets initialized. // widgets initialized.
cursor_window_ = DriSurfaceFactory::kDefaultWidgetHandle; cursor_window_ = DriSurfaceFactory::kDefaultWidgetHandle;
cursor_location_ = gfx::PointF(2560 / 2, 1700 / 2); // TODO(spang): Argh! cursor_location_ = gfx::PointF(2560 / 2, 1700 / 2); // TODO(spang): Argh!
} }
CursorFactoryEvdevDri::~CursorFactoryEvdevDri() {} DriCursor::~DriCursor() {
}
void CursorFactoryEvdevDri::SetBitmapCursor( void DriCursor::SetCursor(gfx::AcceleratedWidget widget,
gfx::AcceleratedWidget widget, PlatformCursor platform_cursor) {
scoped_refptr<BitmapCursorOzone> cursor) { scoped_refptr<BitmapCursorOzone> cursor =
BitmapCursorFactoryOzone::GetBitmapCursor(platform_cursor);
if (cursor_ == cursor) if (cursor_ == cursor)
return; return;
...@@ -34,8 +38,8 @@ void CursorFactoryEvdevDri::SetBitmapCursor( ...@@ -34,8 +38,8 @@ void CursorFactoryEvdevDri::SetBitmapCursor(
hardware_->SetHardwareCursor(cursor_window_, SkBitmap(), gfx::Point()); hardware_->SetHardwareCursor(cursor_window_, SkBitmap(), gfx::Point());
} }
void CursorFactoryEvdevDri::MoveCursorTo(gfx::AcceleratedWidget widget, void DriCursor::MoveCursorTo(gfx::AcceleratedWidget widget,
const gfx::PointF& location) { const gfx::PointF& location) {
if (widget != cursor_window_) if (widget != cursor_window_)
hardware_->SetHardwareCursor(cursor_window_, SkBitmap(), gfx::Point()); hardware_->SetHardwareCursor(cursor_window_, SkBitmap(), gfx::Point());
...@@ -50,19 +54,23 @@ void CursorFactoryEvdevDri::MoveCursorTo(gfx::AcceleratedWidget widget, ...@@ -50,19 +54,23 @@ void CursorFactoryEvdevDri::MoveCursorTo(gfx::AcceleratedWidget widget,
hardware_->MoveHardwareCursor(cursor_window_, bitmap_location()); hardware_->MoveHardwareCursor(cursor_window_, bitmap_location());
} }
void CursorFactoryEvdevDri::MoveCursor(const gfx::Vector2dF& delta) { void DriCursor::MoveCursor(const gfx::Vector2dF& delta) {
MoveCursorTo(cursor_window_, cursor_location_ + delta); MoveCursorTo(cursor_window_, cursor_location_ + delta);
} }
gfx::AcceleratedWidget CursorFactoryEvdevDri::GetCursorWindow() { gfx::AcceleratedWidget DriCursor::GetCursorWindow() {
return cursor_window_; return cursor_window_;
} }
bool CursorFactoryEvdevDri::IsCursorVisible() { return cursor_; } bool DriCursor::IsCursorVisible() {
return cursor_;
}
gfx::PointF CursorFactoryEvdevDri::location() { return cursor_location_; } gfx::PointF DriCursor::location() {
return cursor_location_;
}
gfx::Point CursorFactoryEvdevDri::bitmap_location() { gfx::Point DriCursor::bitmap_location() {
return gfx::ToFlooredPoint(cursor_location_) - return gfx::ToFlooredPoint(cursor_location_) -
cursor_->hotspot().OffsetFromOrigin(); cursor_->hotspot().OffsetFromOrigin();
} }
......
...@@ -2,31 +2,32 @@ ...@@ -2,31 +2,32 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_DRI_CURSOR_FACTORY_EVDEV_DRI_H_ #ifndef UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
#define UI_OZONE_PLATFORM_DRI_CURSOR_FACTORY_EVDEV_DRI_H_ #define UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" #include "base/memory/ref_counted.h"
#include "ui/base/cursor/cursor.h"
#include "ui/events/ozone/evdev/cursor_delegate_evdev.h" #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
namespace gfx {
class PointF;
class Vector2dF;
}
namespace ui { namespace ui {
class BitmapCursorOzone;
class BitmapCursorFactoryOzone;
class HardwareCursorDelegate; class HardwareCursorDelegate;
class CursorFactoryEvdevDri : public BitmapCursorFactoryOzone, class DriCursor : public CursorDelegateEvdev {
public CursorDelegateEvdev {
public: public:
CursorFactoryEvdevDri(HardwareCursorDelegate* cursor); explicit DriCursor(HardwareCursorDelegate* hardware);
virtual ~CursorFactoryEvdevDri(); virtual ~DriCursor();
// BitmapCursorFactoryOzone: void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor);
virtual gfx::AcceleratedWidget GetCursorWindow() OVERRIDE; gfx::AcceleratedWidget GetCursorWindow();
virtual void SetBitmapCursor(gfx::AcceleratedWidget widget,
scoped_refptr<BitmapCursorOzone> cursor)
OVERRIDE;
// CursorDelegateEvdev: // CursorDelegateEvdev:
virtual void MoveCursorTo(gfx::AcceleratedWidget widget, virtual void MoveCursorTo(gfx::AcceleratedWidget widget,
...@@ -54,4 +55,4 @@ class CursorFactoryEvdevDri : public BitmapCursorFactoryOzone, ...@@ -54,4 +55,4 @@ class CursorFactoryEvdevDri : public BitmapCursorFactoryOzone,
} // namespace ui } // namespace ui
#endif // UI_OZONE_PLATFORM_DRI_CURSOR_FACTORY_EVDEV_DRI_H_ #endif // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/events/platform/platform_event_source.h" #include "ui/events/platform/platform_event_source.h"
#include "ui/ozone/platform/dri/dri_cursor.h"
#include "ui/ozone/platform/dri/dri_window_delegate.h" #include "ui/ozone/platform/dri/dri_window_delegate.h"
#include "ui/ozone/platform/dri/dri_window_manager.h" #include "ui/ozone/platform/dri/dri_window_manager.h"
#include "ui/ozone/public/cursor_factory_ozone.h" #include "ui/ozone/public/cursor_factory_ozone.h"
...@@ -18,13 +19,15 @@ DriWindow::DriWindow(PlatformWindowDelegate* delegate, ...@@ -18,13 +19,15 @@ DriWindow::DriWindow(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds, const gfx::Rect& bounds,
scoped_ptr<DriWindowDelegate> dri_window_delegate, scoped_ptr<DriWindowDelegate> dri_window_delegate,
EventFactoryEvdev* event_factory, EventFactoryEvdev* event_factory,
DriWindowManager* window_manager) DriWindowManager* window_manager,
DriCursor* cursor)
: delegate_(delegate), : delegate_(delegate),
bounds_(bounds), bounds_(bounds),
widget_(dri_window_delegate->GetAcceleratedWidget()), widget_(dri_window_delegate->GetAcceleratedWidget()),
dri_window_delegate_(dri_window_delegate.get()), dri_window_delegate_(dri_window_delegate.get()),
event_factory_(event_factory), event_factory_(event_factory),
window_manager_(window_manager) { window_manager_(window_manager),
cursor_(cursor) {
window_manager_->AddWindowDelegate(widget_, dri_window_delegate.Pass()); window_manager_->AddWindowDelegate(widget_, dri_window_delegate.Pass());
} }
...@@ -70,7 +73,7 @@ void DriWindow::Minimize() {} ...@@ -70,7 +73,7 @@ void DriWindow::Minimize() {}
void DriWindow::Restore() {} void DriWindow::Restore() {}
void DriWindow::SetCursor(PlatformCursor cursor) { void DriWindow::SetCursor(PlatformCursor cursor) {
ui::CursorFactoryOzone::GetInstance()->SetCursor(widget_, cursor); cursor_->SetCursor(widget_, cursor);
} }
void DriWindow::MoveCursorTo(const gfx::Point& location) { void DriWindow::MoveCursorTo(const gfx::Point& location) {
...@@ -81,7 +84,7 @@ bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) { ...@@ -81,7 +84,7 @@ bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) {
DCHECK(ne); DCHECK(ne);
Event* event = static_cast<Event*>(ne); Event* event = static_cast<Event*>(ne);
if (event->IsMouseEvent() || event->IsScrollEvent()) if (event->IsMouseEvent() || event->IsScrollEvent())
return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_; return cursor_->GetCursorWindow() == widget_;
return true; return true;
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
namespace ui { namespace ui {
class DriCursor;
class DriWindowDelegate; class DriWindowDelegate;
class DriWindowManager; class DriWindowManager;
class EventFactoryEvdev; class EventFactoryEvdev;
...@@ -24,7 +25,8 @@ class DriWindow : public PlatformWindow, ...@@ -24,7 +25,8 @@ class DriWindow : public PlatformWindow,
const gfx::Rect& bounds, const gfx::Rect& bounds,
scoped_ptr<DriWindowDelegate> dri_window_delegate, scoped_ptr<DriWindowDelegate> dri_window_delegate,
EventFactoryEvdev* event_factory, EventFactoryEvdev* event_factory,
DriWindowManager* window_manager); DriWindowManager* window_manager,
DriCursor* cursor);
virtual ~DriWindow(); virtual ~DriWindow();
void Initialize(); void Initialize();
...@@ -55,6 +57,7 @@ class DriWindow : public PlatformWindow, ...@@ -55,6 +57,7 @@ class DriWindow : public PlatformWindow,
DriWindowDelegate* dri_window_delegate_; DriWindowDelegate* dri_window_delegate_;
EventFactoryEvdev* event_factory_; EventFactoryEvdev* event_factory_;
DriWindowManager* window_manager_; DriWindowManager* window_manager_;
DriCursor* cursor_;
DISALLOW_COPY_AND_ASSIGN(DriWindow); DISALLOW_COPY_AND_ASSIGN(DriWindow);
}; };
......
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
#include "ui/ozone/platform/dri/ozone_platform_dri.h" #include "ui/ozone/platform/dri/ozone_platform_dri.h"
#include "base/at_exit.h" #include "base/at_exit.h"
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
#include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/device/device_manager.h"
#include "ui/events/ozone/evdev/cursor_delegate_evdev.h" #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h"
#include "ui/ozone/platform/dri/dri_buffer.h" #include "ui/ozone/platform/dri/dri_buffer.h"
#include "ui/ozone/platform/dri/dri_cursor.h"
#include "ui/ozone/platform/dri/dri_surface_factory.h" #include "ui/ozone/platform/dri/dri_surface_factory.h"
#include "ui/ozone/platform/dri/dri_window.h" #include "ui/ozone/platform/dri/dri_window.h"
#include "ui/ozone/platform/dri/dri_window_delegate_impl.h" #include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
...@@ -70,7 +71,8 @@ class OzonePlatformDri : public OzonePlatform { ...@@ -70,7 +71,8 @@ class OzonePlatformDri : public OzonePlatform {
scoped_ptr<DriWindowDelegate>(new DriWindowDelegateImpl( scoped_ptr<DriWindowDelegate>(new DriWindowDelegateImpl(
window_manager_.NextAcceleratedWidget(), screen_manager_.get())), window_manager_.NextAcceleratedWidget(), screen_manager_.get())),
event_factory_ozone_.get(), event_factory_ozone_.get(),
&window_manager_)); &window_manager_,
cursor_.get()));
platform_window->Initialize(); platform_window->Initialize();
return platform_window.PassAs<PlatformWindow>(); return platform_window.PassAs<PlatformWindow>();
} }
...@@ -89,10 +91,10 @@ class OzonePlatformDri : public OzonePlatform { ...@@ -89,10 +91,10 @@ class OzonePlatformDri : public OzonePlatform {
virtual void InitializeUI() OVERRIDE { virtual void InitializeUI() OVERRIDE {
surface_factory_ozone_.reset(new DriSurfaceFactory( surface_factory_ozone_.reset(new DriSurfaceFactory(
dri_.get(), screen_manager_.get(), &window_manager_)); dri_.get(), screen_manager_.get(), &window_manager_));
cursor_factory_ozone_.reset( cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
new CursorFactoryEvdevDri(surface_factory_ozone_.get())); cursor_.reset(new DriCursor(surface_factory_ozone_.get()));
event_factory_ozone_.reset(new EventFactoryEvdev( event_factory_ozone_.reset(
cursor_factory_ozone_.get(), device_manager_.get())); new EventFactoryEvdev(cursor_.get(), device_manager_.get()));
if (surface_factory_ozone_->InitializeHardware() != if (surface_factory_ozone_->InitializeHardware() !=
DriSurfaceFactory::INITIALIZED) DriSurfaceFactory::INITIALIZED)
LOG(FATAL) << "failed to initialize display hardware"; LOG(FATAL) << "failed to initialize display hardware";
...@@ -109,7 +111,8 @@ class OzonePlatformDri : public OzonePlatform { ...@@ -109,7 +111,8 @@ class OzonePlatformDri : public OzonePlatform {
scoped_ptr<DeviceManager> device_manager_; scoped_ptr<DeviceManager> device_manager_;
scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; scoped_ptr<DriSurfaceFactory> surface_factory_ozone_;
scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
scoped_ptr<DriCursor> cursor_;
scoped_ptr<EventFactoryEvdev> event_factory_ozone_; scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
DriWindowManager window_manager_; DriWindowManager window_manager_;
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
#include "base/at_exit.h" #include "base/at_exit.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
#include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/device/device_manager.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" #include "ui/ozone/platform/dri/dri_cursor.h"
#include "ui/ozone/platform/dri/dri_window.h" #include "ui/ozone/platform/dri/dri_window.h"
#include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h"
#include "ui/ozone/platform/dri/dri_window_manager.h" #include "ui/ozone/platform/dri/dri_window_manager.h"
...@@ -105,7 +106,8 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -105,7 +106,8 @@ class OzonePlatformGbm : public OzonePlatform {
ui_window_manager_.NextAcceleratedWidget(), ui_window_manager_.NextAcceleratedWidget(),
gpu_platform_support_host_.get())), gpu_platform_support_host_.get())),
event_factory_ozone_.get(), event_factory_ozone_.get(),
&ui_window_manager_)); &ui_window_manager_,
cursor_.get()));
platform_window->Initialize(); platform_window->Initialize();
return platform_window.PassAs<PlatformWindow>(); return platform_window.PassAs<PlatformWindow>();
} }
...@@ -128,10 +130,10 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -128,10 +130,10 @@ class OzonePlatformGbm : public OzonePlatform {
surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
device_manager_ = CreateDeviceManager(); device_manager_ = CreateDeviceManager();
gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm());
cursor_factory_ozone_.reset( cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); cursor_.reset(new DriCursor(gpu_platform_support_host_.get()));
event_factory_ozone_.reset(new EventFactoryEvdev( event_factory_ozone_.reset(
cursor_factory_ozone_.get(), device_manager_.get())); new EventFactoryEvdev(cursor_.get(), device_manager_.get()));
} }
virtual void InitializeGPU() OVERRIDE { virtual void InitializeGPU() OVERRIDE {
...@@ -172,7 +174,8 @@ class OzonePlatformGbm : public OzonePlatform { ...@@ -172,7 +174,8 @@ class OzonePlatformGbm : public OzonePlatform {
scoped_ptr<DeviceManager> device_manager_; scoped_ptr<DeviceManager> device_manager_;
scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_;
scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
scoped_ptr<DriCursor> cursor_;
scoped_ptr<EventFactoryEvdev> event_factory_ozone_; scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_;
......
...@@ -141,7 +141,6 @@ void EgltestWindow::Restore() { ...@@ -141,7 +141,6 @@ void EgltestWindow::Restore() {
} }
void EgltestWindow::SetCursor(PlatformCursor cursor) { void EgltestWindow::SetCursor(PlatformCursor cursor) {
CursorFactoryOzone::GetInstance()->SetCursor(window_id_, cursor);
} }
void EgltestWindow::MoveCursorTo(const gfx::Point& location) { void EgltestWindow::MoveCursorTo(const gfx::Point& location) {
......
...@@ -6,8 +6,6 @@ source_set("test") { ...@@ -6,8 +6,6 @@ source_set("test") {
sources = [ sources = [
"ozone_platform_test.cc", "ozone_platform_test.cc",
"ozone_platform_test.h", "ozone_platform_test.h",
"test_cursor_factory.cc",
"test_cursor_factory.h",
"test_window.cc", "test_window.cc",
"test_window.h", "test_window.h",
"test_window_manager.cc", "test_window_manager.cc",
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
#include "ui/events/platform/platform_event_source.h" #include "ui/events/platform/platform_event_source.h"
#include "ui/ozone/platform/test/test_cursor_factory.h"
#include "ui/ozone/platform/test/test_window.h" #include "ui/ozone/platform/test/test_window.h"
#include "ui/ozone/platform/test/test_window_manager.h" #include "ui/ozone/platform/test/test_window_manager.h"
#include "ui/ozone/public/cursor_factory_ozone.h" #include "ui/ozone/public/cursor_factory_ozone.h"
...@@ -72,7 +72,7 @@ class OzonePlatformTest : public OzonePlatform { ...@@ -72,7 +72,7 @@ class OzonePlatformTest : public OzonePlatform {
if (!PlatformEventSource::GetInstance()) if (!PlatformEventSource::GetInstance())
platform_event_source_ = PlatformEventSource::CreateDefault(); platform_event_source_ = PlatformEventSource::CreateDefault();
cursor_factory_ozone_.reset(new TestCursorFactory()); cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
} }
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
'sources': [ 'sources': [
'ozone_platform_test.cc', 'ozone_platform_test.cc',
'ozone_platform_test.h', 'ozone_platform_test.h',
'test_cursor_factory.cc',
'test_cursor_factory.h',
'test_window.cc', 'test_window.cc',
'test_window.h', 'test_window.h',
'test_window_manager.cc', 'test_window_manager.cc',
......
// Copyright 2014 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.
#include "ui/ozone/platform/test/test_cursor_factory.h"
namespace ui {
TestCursorFactory::TestCursorFactory()
: cursor_window_(gfx::kNullAcceleratedWidget) {}
TestCursorFactory::~TestCursorFactory() {}
gfx::AcceleratedWidget TestCursorFactory::GetCursorWindow() {
return cursor_window_;
}
void TestCursorFactory::SetBitmapCursor(
gfx::AcceleratedWidget widget,
scoped_refptr<BitmapCursorOzone> cursor) {
cursor_window_ = widget;
cursor_ = cursor;
}
} // namespace ui
// Copyright 2014 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 UI_OZONE_PLATFORM_TEST_TEST_CURSOR_FACTORY_H_
#define UI_OZONE_PLATFORM_TEST_TEST_CURSOR_FACTORY_H_
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
namespace ui {
class TestCursorFactory : public BitmapCursorFactoryOzone {
public:
TestCursorFactory();
virtual ~TestCursorFactory();
// BitmapCursorFactoryOzone:
virtual gfx::AcceleratedWidget GetCursorWindow() OVERRIDE;
virtual void SetBitmapCursor(
gfx::AcceleratedWidget widget,
scoped_refptr<BitmapCursorOzone> cursor) OVERRIDE;
private:
gfx::AcceleratedWidget cursor_window_;
scoped_refptr<BitmapCursorOzone> cursor_;
DISALLOW_COPY_AND_ASSIGN(TestCursorFactory);
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_TEST_TEST_CURSOR_FACTORY_H_
...@@ -46,14 +46,4 @@ void CursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) { ...@@ -46,14 +46,4 @@ void CursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void CursorFactoryOzone::SetCursor(gfx::AcceleratedWidget widget,
PlatformCursor cursor) {
NOTIMPLEMENTED();
}
gfx::AcceleratedWidget CursorFactoryOzone::GetCursorWindow() {
NOTIMPLEMENTED();
return 0;
}
} // namespace ui } // namespace ui
...@@ -41,15 +41,6 @@ class OZONE_BASE_EXPORT CursorFactoryOzone { ...@@ -41,15 +41,6 @@ class OZONE_BASE_EXPORT CursorFactoryOzone {
// Decrement platform image cursor refcount. // Decrement platform image cursor refcount.
virtual void UnrefImageCursor(PlatformCursor cursor); virtual void UnrefImageCursor(PlatformCursor cursor);
// Change the active cursor for an AcceleratedWidget.
// TODO(spang): Move this.
virtual void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor cursor);
// Returns the window on which the cursor is active.
// TODO(dnicoara) Move this once the WindowTreeHost refactoring finishes and
// WindowTreeHost::CanDispatchEvent() is no longer present.
virtual gfx::AcceleratedWidget GetCursorWindow();
private: private:
static CursorFactoryOzone* impl_; // not owned static CursorFactoryOzone* impl_; // not owned
}; };
......
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