| Index: ui/ozone/platform/ozonex/ozone_platform_ozonex.cc
|
| diff --git a/ui/ozone/platform/ozonex/ozone_platform_ozonex.cc b/ui/ozone/platform/ozonex/ozone_platform_ozonex.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b27e69ffbf32ce6ec8c2d75c75ddea3e674adf78
|
| --- /dev/null
|
| +++ b/ui/ozone/platform/ozonex/ozone_platform_ozonex.cc
|
| @@ -0,0 +1,117 @@
|
| +// 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/ozonex/ozone_platform_ozonex.h"
|
| +
|
| +#include "ui/events/ozone/event_factory_ozone.cc"
|
| +#include "ui/events/platform/x11/x11_event_source.h"
|
| +#include "ui/gfx/ozone/surface_factory_ozone.h"
|
| +#include "ui/gfx/x/x11_types.h"
|
| +#include "ui/display/types/chromeos/native_display_delegate.h"
|
| +
|
| +#include "ui/window/platform_window.h"
|
| +
|
| +namespace ui {
|
| +namespace {
|
| +
|
| +class StubPlatformWindowDelegate : public ui::PlatformWindowDelegate {
|
| + public:
|
| + virtual ~StubPlatformWindowDelegate() {}
|
| +
|
| + virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE {}
|
| +
|
| + virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE {}
|
| +
|
| + virtual void DispatchEvent(ui::Event* event) OVERRIDE {}
|
| +
|
| + virtual void OnCloseRequest() OVERRIDE {}
|
| + virtual void OnClosed() OVERRIDE {}
|
| +
|
| + virtual void OnWindowStateChanged(
|
| + ui::PlatformWindowState new_state) OVERRIDE {}
|
| +
|
| + virtual void OnLostCapture() OVERRIDE {}
|
| +};
|
| +
|
| +class XSurfaceFactory : public gfx::SurfaceFactoryOzone {
|
| + public:
|
| + virtual HardwareState InitializeHardware() OVERRIDE { return INITIALIZED; }
|
| +
|
| + virtual void ShutdownHardware() OVERRIDE {}
|
| +
|
| + virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 1; }
|
| +
|
| + virtual bool LoadEGLGLES2Bindings(
|
| + AddGLLibraryCallback add_gl_library,
|
| + SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE {
|
| + return false;
|
| + }
|
| +};
|
| +
|
| +class OzonePlatformOzoneX : public OzonePlatform {
|
| + public:
|
| + OzonePlatformOzoneX();
|
| + virtual ~OzonePlatformOzoneX();
|
| +
|
| + virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE;
|
| + virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE;
|
| + virtual ui::InputMethodContextFactoryOzone*
|
| + GetInputMethodContextFactoryOzone() OVERRIDE;
|
| + virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE;
|
| +#if defined(OS_CHROMEOS)
|
| + virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate()
|
| + OVERRIDE;
|
| +#endif
|
| +
|
| + private:
|
| + scoped_ptr<PlatformEventSource> platform_event_source_;
|
| + EventFactoryOzone event_factory_;
|
| + scoped_ptr<PlatformWindow> platform_window_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(OzonePlatformOzoneX);
|
| +};
|
| +
|
| +OzonePlatformOzoneX::OzonePlatformOzoneX()
|
| + : platform_event_source_(new X11EventSource(gfx::GetXDisplay())),
|
| + platform_window_(
|
| + ui::CreateDefaultPlatformWindow(new StubPlatformWindowDelegate())) {
|
| + platform_window_->SetBounds(gfx::Rect(100, 200, 600, 800));
|
| + platform_window_->Show();
|
| +}
|
| +
|
| +OzonePlatformOzoneX::~OzonePlatformOzoneX() {
|
| +}
|
| +
|
| +gfx::SurfaceFactoryOzone* OzonePlatformOzoneX::GetSurfaceFactoryOzone() {
|
| + return new XSurfaceFactory();
|
| +}
|
| +
|
| +ui::EventFactoryOzone* OzonePlatformOzoneX::GetEventFactoryOzone() {
|
| + LOG(ERROR) << "HERE";
|
| + return &event_factory_;
|
| +}
|
| +
|
| +ui::InputMethodContextFactoryOzone*
|
| +OzonePlatformOzoneX::GetInputMethodContextFactoryOzone() {
|
| + return NULL;
|
| +}
|
| +
|
| +ui::CursorFactoryOzone* OzonePlatformOzoneX::GetCursorFactoryOzone() {
|
| + return NULL;
|
| +}
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| +scoped_ptr<ui::NativeDisplayDelegate>
|
| +OzonePlatformOzoneX::CreateNativeDisplayDelegate() {
|
| + return scoped_ptr<ui::NativeDisplayDelegate>();
|
| +}
|
| +#endif
|
| +
|
| +} // namespace
|
| +
|
| +OzonePlatform* CreateOzonePlatformOzonex() {
|
| + return new OzonePlatformOzoneX();
|
| +}
|
| +
|
| +} // namespace ui
|
|
|