summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/env.cc9
-rw-r--r--ui/aura/window_tree_host_ozone.cc3
-rw-r--r--ui/base/cursor/ozone/cursor_factory_ozone.cc12
-rw-r--r--ui/base/cursor/ozone/cursor_factory_ozone.h5
-rw-r--r--ui/events/ozone/device/udev/device_manager_udev.cc16
-rw-r--r--ui/events/ozone/device/udev/device_manager_udev.h3
-rw-r--r--ui/events/ozone/evdev/event_factory_evdev.cc9
-rw-r--r--ui/events/ozone/evdev/event_factory_evdev.h3
-rw-r--r--ui/events/ozone/event_factory_ozone.cc12
-rw-r--r--ui/events/ozone/event_factory_ozone.h5
-rw-r--r--ui/gfx/ozone/surface_factory_ozone.cc8
-rw-r--r--ui/gfx/ozone/surface_factory_ozone.h5
-rw-r--r--ui/gl/gl_implementation_ozone.cc2
-rw-r--r--ui/ozone/ozone_platform.cc42
-rw-r--r--ui/ozone/ozone_platform.h14
-rw-r--r--ui/ozone/platform/caca/ozone_platform_caca.cc31
-rw-r--r--ui/ozone/platform/dri/ozone_platform_dri.cc46
-rw-r--r--ui/ozone/platform/egltest/ozone_platform_egltest.cc35
-rw-r--r--ui/ozone/platform/test/ozone_platform_test.cc48
-rw-r--r--ui/views/widget/desktop_aura/desktop_screen_ozone.cc2
20 files changed, 193 insertions, 117 deletions
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index c850f03..baa6618 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -11,6 +11,10 @@
#include "ui/events/event_target_iterator.h"
#include "ui/events/platform/platform_event_source.h"
+#if defined(USE_OZONE)
+#include "ui/ozone/ozone_platform.h"
+#endif
+
namespace aura {
namespace {
@@ -74,6 +78,11 @@ Env::~Env() {
}
void Env::Init(bool create_event_source) {
+#if defined(USE_OZONE)
+ // The ozone platform can provide its own event source. So initialize the
+ // platform before creating the default event source.
+ ui::OzonePlatform::InitializeForUI();
+#endif
if (create_event_source && !ui::PlatformEventSource::GetInstance())
event_source_ = ui::PlatformEventSource::CreateDefault();
}
diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc
index 5b4a29f..2251eb3 100644
--- a/ui/aura/window_tree_host_ozone.cc
+++ b/ui/aura/window_tree_host_ozone.cc
@@ -9,15 +9,12 @@
#include "ui/events/ozone/event_factory_ozone.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/ozone/surface_factory_ozone.h"
-#include "ui/ozone/ozone_platform.h"
namespace aura {
WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds)
: widget_(0),
bounds_(bounds) {
- ui::OzonePlatform::Initialize();
-
// EventFactoryOzone creates converters that obtain input events from the
// underlying input system and dispatch them as |ui::Event| instances into
// Aura.
diff --git a/ui/base/cursor/ozone/cursor_factory_ozone.cc b/ui/base/cursor/ozone/cursor_factory_ozone.cc
index 709412e..51fd7f8 100644
--- a/ui/base/cursor/ozone/cursor_factory_ozone.cc
+++ b/ui/base/cursor/ozone/cursor_factory_ozone.cc
@@ -11,17 +11,21 @@ namespace ui {
// static
CursorFactoryOzone* CursorFactoryOzone::impl_ = NULL;
-CursorFactoryOzone::CursorFactoryOzone() {}
+CursorFactoryOzone::CursorFactoryOzone() {
+ CHECK(!impl_) << "There should only be a single CursorFactoryOzone.";
+ impl_ = this;
+}
-CursorFactoryOzone::~CursorFactoryOzone() {}
+CursorFactoryOzone::~CursorFactoryOzone() {
+ CHECK_EQ(impl_, this);
+ impl_ = NULL;
+}
CursorFactoryOzone* CursorFactoryOzone::GetInstance() {
CHECK(impl_) << "No CursorFactoryOzone implementation set.";
return impl_;
}
-void CursorFactoryOzone::SetInstance(CursorFactoryOzone* impl) { impl_ = impl; }
-
PlatformCursor CursorFactoryOzone::GetDefaultCursor(int type) {
NOTIMPLEMENTED();
return NULL;
diff --git a/ui/base/cursor/ozone/cursor_factory_ozone.h b/ui/base/cursor/ozone/cursor_factory_ozone.h
index ac18a50..23ac113 100644
--- a/ui/base/cursor/ozone/cursor_factory_ozone.h
+++ b/ui/base/cursor/ozone/cursor_factory_ozone.h
@@ -16,12 +16,9 @@ class UI_BASE_EXPORT CursorFactoryOzone {
CursorFactoryOzone();
virtual ~CursorFactoryOzone();
- // Returns the static instance.
+ // Returns the singleton instance.
static CursorFactoryOzone* GetInstance();
- // Sets the static instance. Ownership is retained by the caller.
- static void SetInstance(CursorFactoryOzone* impl);
-
// Return the default cursor of the specified type. The types are listed in
// ui/base/cursor/cursor.h. Default cursors are managed by the implementation
// and must live indefinitely; there's no way to know when to free them.
diff --git a/ui/events/ozone/device/udev/device_manager_udev.cc b/ui/events/ozone/device/udev/device_manager_udev.cc
index 74e5099..47244a4 100644
--- a/ui/events/ozone/device/udev/device_manager_udev.cc
+++ b/ui/events/ozone/device/udev/device_manager_udev.cc
@@ -78,10 +78,16 @@ scoped_udev_monitor UdevCreateMonitor(struct udev* udev) {
} // namespace
-DeviceManagerUdev::DeviceManagerUdev()
- : udev_(UdevCreate()),
- monitor_(UdevCreateMonitor(udev_.get())) {
+DeviceManagerUdev::DeviceManagerUdev() : udev_(UdevCreate()) {
+}
+
+DeviceManagerUdev::~DeviceManagerUdev() {
+}
+void DeviceManagerUdev::CreateMonitor() {
+ if (monitor_)
+ return;
+ monitor_ = UdevCreateMonitor(udev_.get());
if (monitor_) {
int fd = udev_monitor_get_fd(monitor_.get());
CHECK_GT(fd, 0);
@@ -90,9 +96,9 @@ DeviceManagerUdev::DeviceManagerUdev()
}
}
-DeviceManagerUdev::~DeviceManagerUdev() {}
-
void DeviceManagerUdev::ScanDevices(DeviceEventObserver* observer) {
+ CreateMonitor();
+
scoped_udev_enumerate enumerate(udev_enumerate_new(udev_.get()));
if (!enumerate)
return;
diff --git a/ui/events/ozone/device/udev/device_manager_udev.h b/ui/events/ozone/device/udev/device_manager_udev.h
index e9be943..7c15e3b 100644
--- a/ui/events/ozone/device/udev/device_manager_udev.h
+++ b/ui/events/ozone/device/udev/device_manager_udev.h
@@ -24,6 +24,9 @@ class DeviceManagerUdev
private:
scoped_ptr<DeviceEvent> ProcessMessage(udev_device* device);
+ // Creates a device-monitor to look for device add/remove/change events.
+ void CreateMonitor();
+
// DeviceManager overrides:
virtual void ScanDevices(DeviceEventObserver* observer) OVERRIDE;
virtual void AddObserver(DeviceEventObserver* observer) OVERRIDE;
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc
index 96e8113..cd67af6 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.cc
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc
@@ -196,6 +196,13 @@ void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) {
}
}
+void EventFactoryEvdev::OnDispatcherListChanged() {
+ if (ui_task_runner_)
+ return;
+ ui_task_runner_ = base::MessageLoopProxy::current();
+ StartProcessingEvents();
+}
+
void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) {
TRACE_EVENT1("ozone", "DetachInputDevice", "path", path.value());
CHECK(ui_task_runner_->RunsTasksOnCurrentThread());
@@ -218,6 +225,8 @@ void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) {
}
void EventFactoryEvdev::StartProcessingEvents() {
+ if (!ui_task_runner_)
+ return;
CHECK(ui_task_runner_->RunsTasksOnCurrentThread());
if (device_manager_ && !has_started_processing_events_) {
diff --git a/ui/events/ozone/evdev/event_factory_evdev.h b/ui/events/ozone/evdev/event_factory_evdev.h
index 96add75..f4ded50 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.h
+++ b/ui/events/ozone/evdev/event_factory_evdev.h
@@ -51,6 +51,9 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public EventFactoryOzone,
// Callback for device add (on UI thread).
virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE;
+ // PlatformEventSource:
+ virtual void OnDispatcherListChanged() OVERRIDE;
+
// Owned per-device event converters (by path).
std::map<base::FilePath, EventConverterEvdev*> converters_;
diff --git a/ui/events/ozone/event_factory_ozone.cc b/ui/events/ozone/event_factory_ozone.cc
index 0cc699e..3a56ddc 100644
--- a/ui/events/ozone/event_factory_ozone.cc
+++ b/ui/events/ozone/event_factory_ozone.cc
@@ -11,17 +11,21 @@ namespace ui {
// static
EventFactoryOzone* EventFactoryOzone::impl_ = NULL;
-EventFactoryOzone::EventFactoryOzone() {}
+EventFactoryOzone::EventFactoryOzone() {
+ CHECK(!impl_) << "There should only be a single EventFactoryOzone";
+ impl_ = this;
+}
-EventFactoryOzone::~EventFactoryOzone() {}
+EventFactoryOzone::~EventFactoryOzone() {
+ CHECK_EQ(impl_, this);
+ impl_ = NULL;
+}
EventFactoryOzone* EventFactoryOzone::GetInstance() {
CHECK(impl_) << "No EventFactoryOzone implementation set.";
return impl_;
}
-void EventFactoryOzone::SetInstance(EventFactoryOzone* impl) { impl_ = impl; }
-
void EventFactoryOzone::StartProcessingEvents() {}
void EventFactoryOzone::WarpCursorTo(gfx::AcceleratedWidget widget,
diff --git a/ui/events/ozone/event_factory_ozone.h b/ui/events/ozone/event_factory_ozone.h
index 888317a..d243761 100644
--- a/ui/events/ozone/event_factory_ozone.h
+++ b/ui/events/ozone/event_factory_ozone.h
@@ -44,12 +44,9 @@ class EVENTS_OZONE_EXPORT EventFactoryOzone {
virtual void WarpCursorTo(gfx::AcceleratedWidget widget,
const gfx::PointF& location);
- // Returns the static instance last set using SetInstance().
+ // Returns the singleton instance.
static EventFactoryOzone* GetInstance();
- // Sets the implementation delegate. Ownership is retained by the caller.
- static void SetInstance(EventFactoryOzone*);
-
private:
static EventFactoryOzone* impl_; // not owned
diff --git a/ui/gfx/ozone/surface_factory_ozone.cc b/ui/gfx/ozone/surface_factory_ozone.cc
index f17c13d..a1dbdd1 100644
--- a/ui/gfx/ozone/surface_factory_ozone.cc
+++ b/ui/gfx/ozone/surface_factory_ozone.cc
@@ -16,9 +16,13 @@ namespace gfx {
SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL;
SurfaceFactoryOzone::SurfaceFactoryOzone() {
+ CHECK(!impl_) << "There should only be a single SurfaceFactoryOzone.";
+ impl_ = this;
}
SurfaceFactoryOzone::~SurfaceFactoryOzone() {
+ CHECK_EQ(impl_, this);
+ impl_ = NULL;
}
SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() {
@@ -26,10 +30,6 @@ SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() {
return impl_;
}
-void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) {
- impl_ = impl;
-}
-
intptr_t SurfaceFactoryOzone::GetNativeDisplay() {
return 0;
}
diff --git a/ui/gfx/ozone/surface_factory_ozone.h b/ui/gfx/ozone/surface_factory_ozone.h
index 9f7e728..b7eb83b 100644
--- a/ui/gfx/ozone/surface_factory_ozone.h
+++ b/ui/gfx/ozone/surface_factory_ozone.h
@@ -82,12 +82,9 @@ class GFX_EXPORT SurfaceFactoryOzone {
SurfaceFactoryOzone();
virtual ~SurfaceFactoryOzone();
- // Returns the instance
+ // Returns the singleton instance.
static SurfaceFactoryOzone* GetInstance();
- // Sets the implementation delegate. Ownership is retained by the caller.
- static void SetInstance(SurfaceFactoryOzone* impl);
-
// Configures the display hardware. Must be called from within the GPU
// process before the sandbox has been activated.
virtual HardwareState InitializeHardware() = 0;
diff --git a/ui/gl/gl_implementation_ozone.cc b/ui/gl/gl_implementation_ozone.cc
index cb08036..07f82d3c 100644
--- a/ui/gl/gl_implementation_ozone.cc
+++ b/ui/gl/gl_implementation_ozone.cc
@@ -43,7 +43,7 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
case kGLImplementationOSMesaGL:
return InitializeStaticGLBindingsOSMesaGL();
case kGLImplementationEGLGLES2:
- ui::OzonePlatform::Initialize();
+ ui::OzonePlatform::InitializeForGPU();
if (!gfx::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings(
base::Bind(&AddGLNativeLibrary),
base::Bind(&SetGLGetProcAddressProc)))
diff --git a/ui/ozone/ozone_platform.cc b/ui/ozone/ozone_platform.cc
index e8199b2..730be36 100644
--- a/ui/ozone/ozone_platform.cc
+++ b/ui/ozone/ozone_platform.cc
@@ -40,31 +40,28 @@ std::string GetPlatformName() {
} // namespace
-OzonePlatform::OzonePlatform() {}
+OzonePlatform::OzonePlatform() {
+ CHECK(!instance_) << "There should only be a single OzonePlatform.";
+ instance_ = this;
+}
OzonePlatform::~OzonePlatform() {
- gfx::SurfaceFactoryOzone::SetInstance(NULL);
- ui::EventFactoryOzone::SetInstance(NULL);
- ui::CursorFactoryOzone::SetInstance(NULL);
+ CHECK_EQ(instance_, this);
+ instance_ = NULL;
}
// static
-void OzonePlatform::Initialize() {
- if (instance_)
- return;
-
- std::string platform = GetPlatformName();
-
- TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform);
-
- instance_ = CreatePlatform(platform);
-
- // Inject ozone interfaces.
- gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone());
- ui::EventFactoryOzone::SetInstance(instance_->GetEventFactoryOzone());
+void OzonePlatform::InitializeForUI() {
+ CreateInstance();
+ instance_->InitializeUI();
ui::InputMethodContextFactoryOzone::SetInstance(
instance_->GetInputMethodContextFactoryOzone());
- ui::CursorFactoryOzone::SetInstance(instance_->GetCursorFactoryOzone());
+}
+
+// static
+void OzonePlatform::InitializeForGPU() {
+ CreateInstance();
+ instance_->InitializeGPU();
}
// static
@@ -74,6 +71,15 @@ OzonePlatform* OzonePlatform::GetInstance() {
}
// static
+void OzonePlatform::CreateInstance() {
+ if (!instance_) {
+ std::string platform = GetPlatformName();
+ TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform);
+ CreatePlatform(platform);
+ }
+}
+
+// static
OzonePlatform* OzonePlatform::instance_;
} // namespace ui
diff --git a/ui/ozone/ozone_platform.h b/ui/ozone/ozone_platform.h
index 536ff0e..7a9a667 100644
--- a/ui/ozone/ozone_platform.h
+++ b/ui/ozone/ozone_platform.h
@@ -38,9 +38,12 @@ class OZONE_EXPORT OzonePlatform {
OzonePlatform();
virtual ~OzonePlatform();
- // Initialize the platform. Once complete, SurfaceFactoryOzone &
- // EventFactoryOzone will be set.
- static void Initialize();
+ // Initializes the subsystems/resources necessary for the UI process (e.g.
+ // events, surface, etc.)
+ static void InitializeForUI();
+
+ // Initializes the subsystems/resources necessary for the GPU process.
+ static void InitializeForGPU();
static OzonePlatform* GetInstance();
@@ -58,6 +61,11 @@ class OZONE_EXPORT OzonePlatform {
#endif
private:
+ virtual void InitializeUI() = 0;
+ virtual void InitializeGPU() = 0;
+
+ static void CreateInstance();
+
static OzonePlatform* instance_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatform);
diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/caca/ozone_platform_caca.cc
index a5a6b02a..a39e235 100644
--- a/ui/ozone/platform/caca/ozone_platform_caca.cc
+++ b/ui/ozone/platform/caca/ozone_platform_caca.cc
@@ -21,24 +21,22 @@ namespace {
class OzonePlatformCaca : public OzonePlatform {
public:
- OzonePlatformCaca()
- : surface_factory_ozone_(&connection_),
- event_factory_ozone_(&connection_) {}
+ OzonePlatformCaca() {}
virtual ~OzonePlatformCaca() {}
// OzonePlatform:
virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
- return &surface_factory_ozone_;
+ return surface_factory_ozone_.get();
}
virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
- return &event_factory_ozone_;
+ return event_factory_ozone_.get();
}
virtual InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone()
OVERRIDE {
- return &input_method_context_factory_ozone_;
+ return input_method_context_factory_ozone_.get();
}
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
- return &cursor_factory_ozone_;
+ return cursor_factory_ozone_.get();
}
#if defined(OS_CHROMEOS)
@@ -48,13 +46,24 @@ class OzonePlatformCaca : public OzonePlatform {
}
#endif
+ virtual void InitializeUI() OVERRIDE {
+ surface_factory_ozone_.reset(new CacaSurfaceFactory(&connection_));
+ event_factory_ozone_.reset(new CacaEventFactory(&connection_));
+ input_method_context_factory_ozone_.reset(
+ new InputMethodContextFactoryOzone());
+ cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ }
+
+ virtual void InitializeGPU() OVERRIDE {}
+
private:
CacaConnection connection_;
- CacaSurfaceFactory surface_factory_ozone_;
- CacaEventFactory event_factory_ozone_;
+ scoped_ptr<CacaSurfaceFactory> surface_factory_ozone_;
+ scoped_ptr<CacaEventFactory> event_factory_ozone_;
// This creates a minimal input context.
- InputMethodContextFactoryOzone input_method_context_factory_ozone_;
- CursorFactoryOzone cursor_factory_ozone_;
+ scoped_ptr<InputMethodContextFactoryOzone>
+ input_method_context_factory_ozone_;
+ scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca);
};
diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc
index 91a5e15..17e000b 100644
--- a/ui/ozone/platform/dri/ozone_platform_dri.cc
+++ b/ui/ozone/platform/dri/ozone_platform_dri.cc
@@ -33,33 +33,42 @@ class OzonePlatformDri : public OzonePlatform {
OzonePlatformDri()
: dri_(new DriWrapper(kDefaultGraphicsCardPath)),
screen_manager_(new ScreenManager(dri_.get())),
- device_manager_(CreateDeviceManager()),
- surface_factory_ozone_(dri_.get(), screen_manager_.get()),
- cursor_factory_ozone_(&surface_factory_ozone_),
- event_factory_ozone_(&cursor_factory_ozone_, device_manager_.get()) {}
+ device_manager_(CreateDeviceManager()) {}
virtual ~OzonePlatformDri() {}
// OzonePlatform:
virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
- return &surface_factory_ozone_;
+ return surface_factory_ozone_.get();
}
- virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
- return &event_factory_ozone_;
+ virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
+ return event_factory_ozone_.get();
}
- virtual ui::InputMethodContextFactoryOzone*
- GetInputMethodContextFactoryOzone() OVERRIDE {
- return &input_method_context_factory_ozone_;
+ virtual InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone()
+ OVERRIDE {
+ return input_method_context_factory_ozone_.get();
}
- virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
- return &cursor_factory_ozone_;
+ virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
+ return cursor_factory_ozone_.get();
}
#if defined(OS_CHROMEOS)
- virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate()
+ virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
OVERRIDE {
- return scoped_ptr<ui::NativeDisplayDelegate>(new NativeDisplayDelegateDri(
+ return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri(
dri_.get(), screen_manager_.get(), device_manager_.get()));
}
#endif
+ virtual void InitializeUI() OVERRIDE {
+ surface_factory_ozone_.reset(
+ new DriSurfaceFactory(dri_.get(), screen_manager_.get()));
+ cursor_factory_ozone_.reset(
+ new CursorFactoryEvdevDri(surface_factory_ozone_.get()));
+ event_factory_ozone_.reset(new EventFactoryEvdev(
+ cursor_factory_ozone_.get(), device_manager_.get()));
+ input_method_context_factory_ozone_.reset(
+ new InputMethodContextFactoryOzone());
+ }
+
+ virtual void InitializeGPU() OVERRIDE {}
private:
scoped_ptr<DriWrapper> dri_;
@@ -67,11 +76,12 @@ class OzonePlatformDri : public OzonePlatform {
scoped_ptr<ScreenManager> screen_manager_;
scoped_ptr<DeviceManager> device_manager_;
- ui::DriSurfaceFactory surface_factory_ozone_;
- ui::CursorFactoryEvdevDri cursor_factory_ozone_;
- ui::EventFactoryEvdev event_factory_ozone_;
+ scoped_ptr<DriSurfaceFactory> surface_factory_ozone_;
+ scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_;
+ scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
// This creates a minimal input context.
- ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_;
+ scoped_ptr<InputMethodContextFactoryOzone>
+ input_method_context_factory_ozone_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri);
};
diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
index d45cb22..d75c786 100644
--- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc
+++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
@@ -205,11 +205,7 @@ const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties(
// hardware platforms.
class OzonePlatformEgltest : public OzonePlatform {
public:
- OzonePlatformEgltest()
- : device_manager_(CreateDeviceManager()),
- surface_factory_ozone_(&eglplatform_shim_),
- event_factory_ozone_(NULL, device_manager_.get()),
- shim_initialized_(false) {}
+ OzonePlatformEgltest() : shim_initialized_(false) {}
virtual ~OzonePlatformEgltest() {
if (shim_initialized_)
eglplatform_shim_.ShimTerminate();
@@ -239,17 +235,17 @@ class OzonePlatformEgltest : public OzonePlatform {
// OzonePlatform:
virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
- return &surface_factory_ozone_;
+ return surface_factory_ozone_.get();
}
virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
- return &event_factory_ozone_;
+ return event_factory_ozone_.get();
}
virtual InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone()
OVERRIDE {
- return &input_method_context_factory_ozone_;
+ return input_method_context_factory_ozone_.get();
}
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
- return &cursor_factory_ozone_;
+ return cursor_factory_ozone_.get();
}
#if defined(OS_CHROMEOS)
@@ -259,13 +255,26 @@ class OzonePlatformEgltest : public OzonePlatform {
}
#endif
+ virtual void InitializeUI() OVERRIDE {
+ device_manager_ = CreateDeviceManager();
+ surface_factory_ozone_.reset(new SurfaceFactoryEgltest(&eglplatform_shim_));
+ event_factory_ozone_.reset(
+ new EventFactoryEvdev(NULL, device_manager_.get()));
+ input_method_context_factory_ozone_.reset(
+ new InputMethodContextFactoryOzone());
+ cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ }
+
+ virtual void InitializeGPU() OVERRIDE {}
+
private:
LibeglplatformShimLoader eglplatform_shim_;
scoped_ptr<DeviceManager> device_manager_;
- SurfaceFactoryEgltest surface_factory_ozone_;
- EventFactoryEvdev event_factory_ozone_;
- InputMethodContextFactoryOzone input_method_context_factory_ozone_;
- CursorFactoryOzone cursor_factory_ozone_;
+ scoped_ptr<SurfaceFactoryEgltest> surface_factory_ozone_;
+ scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
+ scoped_ptr<InputMethodContextFactoryOzone>
+ input_method_context_factory_ozone_;
+ scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
bool shim_initialized_;
diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/test/ozone_platform_test.cc
index 3976eb5..8dcbde7 100644
--- a/ui/ozone/platform/test/ozone_platform_test.cc
+++ b/ui/ozone/platform/test/ozone_platform_test.cc
@@ -27,41 +27,51 @@ namespace {
// This platform dumps images to a file for testing purposes.
class OzonePlatformTest : public OzonePlatform {
public:
- OzonePlatformTest(const base::FilePath& dump_file)
- : device_manager_(CreateDeviceManager()),
- surface_factory_ozone_(dump_file),
- event_factory_ozone_(NULL, device_manager_.get()) {}
+ OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {}
virtual ~OzonePlatformTest() {}
// OzonePlatform:
virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
- return &surface_factory_ozone_;
+ return surface_factory_ozone_.get();
}
- virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
- return &event_factory_ozone_;
+ virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
+ return event_factory_ozone_.get();
}
- virtual ui::InputMethodContextFactoryOzone*
- GetInputMethodContextFactoryOzone() OVERRIDE {
- return &input_method_context_factory_ozone_;
+ virtual InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone()
+ OVERRIDE {
+ return input_method_context_factory_ozone_.get();
}
- virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
- return &cursor_factory_ozone_;
+ virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
+ return cursor_factory_ozone_.get();
}
#if defined(OS_CHROMEOS)
- virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate()
+ virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
OVERRIDE {
- return scoped_ptr<ui::NativeDisplayDelegate>(
- new NativeDisplayDelegateOzone());
+ return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone());
}
#endif
+ virtual void InitializeUI() OVERRIDE {
+ device_manager_ = CreateDeviceManager();
+ surface_factory_ozone_.reset(new gfx::FileSurfaceFactory(file_path_));
+ event_factory_ozone_.reset(
+ new EventFactoryEvdev(NULL, device_manager_.get()));
+ input_method_context_factory_ozone_.reset(
+ new InputMethodContextFactoryOzone());
+ cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ }
+
+ virtual void InitializeGPU() OVERRIDE {}
+
private:
scoped_ptr<DeviceManager> device_manager_;
- gfx::FileSurfaceFactory surface_factory_ozone_;
- ui::EventFactoryEvdev event_factory_ozone_;
- ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_;
- ui::CursorFactoryOzone cursor_factory_ozone_;
+ scoped_ptr<gfx::FileSurfaceFactory> surface_factory_ozone_;
+ scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
+ scoped_ptr<InputMethodContextFactoryOzone>
+ input_method_context_factory_ozone_;
+ scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
+ base::FilePath file_path_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest);
};
diff --git a/ui/views/widget/desktop_aura/desktop_screen_ozone.cc b/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
index 6c55165..9708ad8 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
@@ -4,13 +4,11 @@
#include "ui/views/widget/desktop_aura/desktop_screen.h"
-#include "ui/ozone/ozone_platform.h"
#include "ui/views/widget/desktop_aura/desktop_factory_ozone.h"
namespace views {
gfx::Screen* CreateDesktopScreen() {
- ui::OzonePlatform::Initialize();
return DesktopFactoryOzone::GetInstance()->CreateDesktopScreen();
}