diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-20 13:24:02 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-20 13:24:02 +0000 |
commit | 0e37fc20ae81db989720222f9a1e263e25766638 (patch) | |
tree | a0dfa12ad0edc161c1025ff5c5c4b9c5ddbc9bf7 | |
parent | 431e63b8c63954b48167b8f83fb68615030104de (diff) | |
download | chromium_src-0e37fc20ae81db989720222f9a1e263e25766638.zip chromium_src-0e37fc20ae81db989720222f9a1e263e25766638.tar.gz chromium_src-0e37fc20ae81db989720222f9a1e263e25766638.tar.bz2 |
ozone: Move the factory interfaces into a common target.
This patch moves:
* CursorFactoryOzone out of ui/base/cursor/ into ui/ozone/public
* EventFactoryOzone out of ui/events/ into ui/ozone/public
* SurfaceFactoryOzone, OverlayCandidatesOzone, SurfaceOzoneCanvas, and
SurfaceOzoneEGL out of ui/gfx/ into ui/ozone/public
* FileSurfaceFactory out of ui/gfx/ into ui/ozone/platform/test, since
the test platform is the only one that uses it.
This patch also builds a separate ozone_base target that includes just the
factories.
BUG=361137
R=bsalomon@google.com, piman@chromium.org, rjkroege@chromium.org, sky@chromium.org, spang@chromium.org
Review URL: https://codereview.chromium.org/312393002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278699 0039d316-1c4b-4281-b951-d872f2087c98
61 files changed, 293 insertions, 289 deletions
diff --git a/content/DEPS b/content/DEPS index 614ae7a..6fd07fe 100644 --- a/content/DEPS +++ b/content/DEPS @@ -86,6 +86,7 @@ include_rules = [ "+ui/gfx", "+ui/gl", "+ui/native_theme", + "+ui/ozone/public", "+ui/shell_dialogs", "+ui/snapshot", "+ui/surface", diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index d268b94..bdf7cb4 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -48,7 +48,7 @@ #elif defined(USE_OZONE) #include "content/browser/compositor/overlay_candidate_validator_ozone.h" #include "content/browser/compositor/software_output_device_ozone.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" +#include "ui/ozone/public/surface_factory_ozone.h" #elif defined(USE_X11) #include "content/browser/compositor/software_output_device_x11.h" #elif defined(OS_MACOSX) @@ -121,8 +121,8 @@ scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( scoped_ptr<cc::OverlayCandidateValidator> CreateOverlayCandidateValidator( gfx::AcceleratedWidget widget) { #if defined(USE_OZONE) - gfx::OverlayCandidatesOzone* overlay_candidates = - gfx::SurfaceFactoryOzone::GetInstance()->GetOverlayCandidates(widget); + ui::OverlayCandidatesOzone* overlay_candidates = + ui::SurfaceFactoryOzone::GetInstance()->GetOverlayCandidates(widget); if (overlay_candidates && CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableHardwareOverlays)) { return scoped_ptr<cc::OverlayCandidateValidator>( diff --git a/content/browser/compositor/overlay_candidate_validator_ozone.cc b/content/browser/compositor/overlay_candidate_validator_ozone.cc index 7ca5a97..b4a3cfe 100644 --- a/content/browser/compositor/overlay_candidate_validator_ozone.cc +++ b/content/browser/compositor/overlay_candidate_validator_ozone.cc @@ -4,15 +4,15 @@ #include "content/browser/compositor/overlay_candidate_validator_ozone.h" -#include "ui/gfx/ozone/overlay_candidates_ozone.h" +#include "ui/ozone/public/overlay_candidates_ozone.h" namespace content { -static gfx::SurfaceFactoryOzone::BufferFormat GetOzoneFormat( +static ui::SurfaceFactoryOzone::BufferFormat GetOzoneFormat( cc::ResourceFormat overlay_format) { switch (overlay_format) { case cc::RGBA_8888: - return gfx::SurfaceFactoryOzone::RGBA_8888; + return ui::SurfaceFactoryOzone::RGBA_8888; case cc::RGBA_4444: case cc::BGRA_8888: case cc::LUMINANCE_8: @@ -21,20 +21,21 @@ static gfx::SurfaceFactoryOzone::BufferFormat GetOzoneFormat( break; } NOTREACHED(); - return gfx::SurfaceFactoryOzone::UNKNOWN; + return ui::SurfaceFactoryOzone::UNKNOWN; } OverlayCandidateValidatorOzone::OverlayCandidateValidatorOzone( gfx::AcceleratedWidget widget, - gfx::OverlayCandidatesOzone* overlay_candidates) - : widget_(widget), overlay_candidates_(overlay_candidates) {} + ui::OverlayCandidatesOzone* overlay_candidates) + : widget_(widget), overlay_candidates_(overlay_candidates) { +} OverlayCandidateValidatorOzone::~OverlayCandidateValidatorOzone() {} void OverlayCandidateValidatorOzone::CheckOverlaySupport( cc::OverlayCandidateList* surfaces) { DCHECK_GE(2U, surfaces->size()); - gfx::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; + ui::OverlayCandidatesOzone::OverlaySurfaceCandidateList ozone_surface_list; ozone_surface_list.resize(surfaces->size()); for (size_t i = 0; i < surfaces->size(); i++) { diff --git a/content/browser/compositor/overlay_candidate_validator_ozone.h b/content/browser/compositor/overlay_candidate_validator_ozone.h index c46eaba..8fb690b 100644 --- a/content/browser/compositor/overlay_candidate_validator_ozone.h +++ b/content/browser/compositor/overlay_candidate_validator_ozone.h @@ -10,7 +10,7 @@ #include "content/common/content_export.h" #include "ui/gfx/native_widget_types.h" -namespace gfx { +namespace ui { class OverlayCandidatesOzone; } @@ -21,7 +21,7 @@ class CONTENT_EXPORT OverlayCandidateValidatorOzone public: OverlayCandidateValidatorOzone( gfx::AcceleratedWidget widget, - gfx::OverlayCandidatesOzone* overlay_candidates); + ui::OverlayCandidatesOzone* overlay_candidates); virtual ~OverlayCandidateValidatorOzone(); // cc::OverlayCandidateValidator implementation. @@ -29,7 +29,7 @@ class CONTENT_EXPORT OverlayCandidateValidatorOzone private: gfx::AcceleratedWidget widget_; - gfx::OverlayCandidatesOzone* overlay_candidates_; + ui::OverlayCandidatesOzone* overlay_candidates_; DISALLOW_COPY_AND_ASSIGN(OverlayCandidateValidatorOzone); }; diff --git a/content/browser/compositor/software_output_device_ozone.cc b/content/browser/compositor/software_output_device_ozone.cc index e5514a8..b97b8b7 100644 --- a/content/browser/compositor/software_output_device_ozone.cc +++ b/content/browser/compositor/software_output_device_ozone.cc @@ -5,18 +5,18 @@ #include "content/browser/compositor/software_output_device_ozone.h" #include "third_party/skia/include/core/SkDevice.h" #include "ui/compositor/compositor.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/vsync_provider.h" +#include "ui/ozone/public/surface_factory_ozone.h" +#include "ui/ozone/public/surface_ozone_canvas.h" namespace content { SoftwareOutputDeviceOzone::SoftwareOutputDeviceOzone(ui::Compositor* compositor) : compositor_(compositor) { - gfx::SurfaceFactoryOzone* factory = gfx::SurfaceFactoryOzone::GetInstance(); + ui::SurfaceFactoryOzone* factory = ui::SurfaceFactoryOzone::GetInstance(); - if (factory->InitializeHardware() != gfx::SurfaceFactoryOzone::INITIALIZED) + if (factory->InitializeHardware() != ui::SurfaceFactoryOzone::INITIALIZED) LOG(FATAL) << "Failed to initialize hardware in OZONE"; surface_ozone_ = factory->CreateCanvasForWidget(compositor_->widget()); diff --git a/content/browser/compositor/software_output_device_ozone.h b/content/browser/compositor/software_output_device_ozone.h index 74ef6fd..600138f 100644 --- a/content/browser/compositor/software_output_device_ozone.h +++ b/content/browser/compositor/software_output_device_ozone.h @@ -11,9 +11,6 @@ namespace ui { class Compositor; -} - -namespace gfx { class SurfaceOzoneCanvas; } @@ -36,7 +33,7 @@ class CONTENT_EXPORT SoftwareOutputDeviceOzone private: ui::Compositor* compositor_; - scoped_ptr<gfx::SurfaceOzoneCanvas> surface_ozone_; + scoped_ptr<ui::SurfaceOzoneCanvas> surface_ozone_; DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceOzone); }; diff --git a/content/browser/compositor/software_output_device_ozone_unittest.cc b/content/browser/compositor/software_output_device_ozone_unittest.cc index 009bd89..a2176a6 100644 --- a/content/browser/compositor/software_output_device_ozone_unittest.cc +++ b/content/browser/compositor/software_output_device_ozone_unittest.cc @@ -10,21 +10,21 @@ #include "third_party/skia/include/core/SkSurface.h" #include "ui/compositor/compositor.h" #include "ui/compositor/test/context_factories_for_test.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" #include "ui/gfx/size.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/vsync_provider.h" #include "ui/gl/gl_implementation.h" +#include "ui/ozone/public/surface_factory_ozone.h" +#include "ui/ozone/public/surface_ozone_canvas.h" namespace { -class MockSurfaceOzone : public gfx::SurfaceOzoneCanvas { +class MockSurfaceOzone : public ui::SurfaceOzoneCanvas { public: MockSurfaceOzone() {} virtual ~MockSurfaceOzone() {} - // gfx::SurfaceOzoneCanvas overrides: + // ui::SurfaceOzoneCanvas overrides: virtual void ResizeCanvas(const gfx::Size& size) OVERRIDE { surface_ = skia::AdoptRef(SkSurface::NewRaster( SkImageInfo::MakeN32Premul(size.width(), size.height()))); @@ -43,7 +43,7 @@ class MockSurfaceOzone : public gfx::SurfaceOzoneCanvas { DISALLOW_COPY_AND_ASSIGN(MockSurfaceOzone); }; -class MockSurfaceFactoryOzone : public gfx::SurfaceFactoryOzone { +class MockSurfaceFactoryOzone : public ui::SurfaceFactoryOzone { public: MockSurfaceFactoryOzone() {} virtual ~MockSurfaceFactoryOzone() {} @@ -59,9 +59,9 @@ class MockSurfaceFactoryOzone : public gfx::SurfaceFactoryOzone { SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE { return false; } - virtual scoped_ptr<gfx::SurfaceOzoneCanvas> CreateCanvasForWidget( + virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget( gfx::AcceleratedWidget widget) OVERRIDE { - return make_scoped_ptr<gfx::SurfaceOzoneCanvas>(new MockSurfaceOzone()); + return make_scoped_ptr<ui::SurfaceOzoneCanvas>(new MockSurfaceOzone()); } private: @@ -85,7 +85,7 @@ class SoftwareOutputDeviceOzoneTest : public testing::Test { private: scoped_ptr<ui::Compositor> compositor_; scoped_ptr<base::MessageLoop> message_loop_; - scoped_ptr<gfx::SurfaceFactoryOzone> surface_factory_; + scoped_ptr<ui::SurfaceFactoryOzone> surface_factory_; DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceOzoneTest); }; @@ -106,7 +106,7 @@ void SoftwareOutputDeviceOzoneTest::SetUp() { const gfx::Size size(500, 400); compositor_.reset(new ui::Compositor( - gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget(), + ui::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget(), context_factory)); compositor_->SetScaleAndSize(1.0f, size); diff --git a/content/common/cursors/webcursor_ozone.cc b/content/common/cursors/webcursor_ozone.cc index abd4cf0..fe3dbd9 100644 --- a/content/common/cursors/webcursor_ozone.cc +++ b/content/common/cursors/webcursor_ozone.cc @@ -7,7 +7,7 @@ #include "third_party/WebKit/public/platform/WebCursorInfo.h" #include "ui/base/cursor/cursor.h" #include "ui/base/cursor/cursor_util.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" +#include "ui/ozone/public/cursor_factory_ozone.h" namespace content { diff --git a/content/content_tests.gypi b/content/content_tests.gypi index f662451..fc0de43 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -915,7 +915,7 @@ }], ['use_ozone==1', { 'dependencies': [ - '../ui/gfx/ozone/gfx_ozone.gyp:gfx_ozone', + '../ui/ozone/ozone.gyp:ozone_base', ], }], ], diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc index 5b8be53..d247734 100644 --- a/ui/aura/window_tree_host_ozone.cc +++ b/ui/aura/window_tree_host_ozone.cc @@ -5,18 +5,18 @@ #include "ui/aura/window_tree_host_ozone.h" #include "ui/aura/window_event_dispatcher.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" -#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/public/cursor_factory_ozone.h" +#include "ui/ozone/public/event_factory_ozone.h" +#include "ui/ozone/public/surface_factory_ozone.h" namespace aura { WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) : widget_(0), bounds_(bounds) { - gfx::SurfaceFactoryOzone* surface_factory = - gfx::SurfaceFactoryOzone::GetInstance(); + ui::SurfaceFactoryOzone* surface_factory = + ui::SurfaceFactoryOzone::GetInstance(); widget_ = surface_factory->GetAcceleratedWidget(); ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); diff --git a/ui/base/cursor/DEPS b/ui/base/cursor/DEPS new file mode 100644 index 0000000..de08167 --- /dev/null +++ b/ui/base/cursor/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+ui/ozone/public", +] diff --git a/ui/base/cursor/cursor_loader_ozone.cc b/ui/base/cursor/cursor_loader_ozone.cc index b56648f..8309c2e 100644 --- a/ui/base/cursor/cursor_loader_ozone.cc +++ b/ui/base/cursor/cursor_loader_ozone.cc @@ -5,9 +5,9 @@ #include "ui/base/cursor/cursor_loader_ozone.h" #include "ui/base/cursor/cursor.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image_skia.h" +#include "ui/ozone/public/cursor_factory_ozone.h" namespace ui { diff --git a/ui/base/cursor/cursor_ozone.cc b/ui/base/cursor/cursor_ozone.cc index deb17c2..c4ef8c4 100644 --- a/ui/base/cursor/cursor_ozone.cc +++ b/ui/base/cursor/cursor_ozone.cc @@ -4,7 +4,7 @@ #include "ui/base/cursor/cursor.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" +#include "ui/ozone/public/cursor_factory_ozone.h" namespace ui { diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h index aef4d7ce..916e129 100644 --- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h +++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h @@ -10,9 +10,9 @@ #include "base/memory/ref_counted.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/cursor/cursor.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" #include "ui/base/ui_base_export.h" #include "ui/gfx/geometry/point.h" +#include "ui/ozone/public/cursor_factory_ozone.h" namespace ui { diff --git a/ui/base/ui_base.gyp b/ui/base/ui_base.gyp index 43ed150..e5ddcd7 100644 --- a/ui/base/ui_base.gyp +++ b/ui/base/ui_base.gyp @@ -136,8 +136,6 @@ 'cursor/image_cursors.h', 'cursor/ozone/bitmap_cursor_factory_ozone.cc', 'cursor/ozone/bitmap_cursor_factory_ozone.h', - 'cursor/ozone/cursor_factory_ozone.cc', - 'cursor/ozone/cursor_factory_ozone.h', 'default_theme_provider.cc', 'default_theme_provider.h', 'default_theme_provider_mac.mm', @@ -373,6 +371,11 @@ 'resource/resource_bundle_auralinux.cc', ], }], + ['use_ozone==1', { + 'dependencies': [ + '../ozone/ozone.gyp:ozone_base', + ], + }], ['use_aura==1 and OS=="win"', { 'sources/': [ ['exclude', 'dragdrop/drag_utils_aura.cc'], diff --git a/ui/events/ozone/DEPS b/ui/events/ozone/DEPS index 911cdbe..3f27114 100644 --- a/ui/events/ozone/DEPS +++ b/ui/events/ozone/DEPS @@ -1,3 +1,4 @@ include_rules = [ "+device/udev_linux", + "+ui/ozone/public", ] diff --git a/ui/events/ozone/evdev/event_converter_evdev.cc b/ui/events/ozone/evdev/event_converter_evdev.cc index 0a54fc4..5b1e9a5 100644 --- a/ui/events/ozone/evdev/event_converter_evdev.cc +++ b/ui/events/ozone/evdev/event_converter_evdev.cc @@ -5,7 +5,7 @@ #include "ui/events/ozone/evdev/event_converter_evdev.h" #include "ui/events/event.h" -#include "ui/events/ozone/event_factory_ozone.h" +#include "ui/ozone/public/event_factory_ozone.h" namespace ui { diff --git a/ui/events/ozone/evdev/event_factory_evdev.h b/ui/events/ozone/evdev/event_factory_evdev.h index da56524..3eb11d2 100644 --- a/ui/events/ozone/evdev/event_factory_evdev.h +++ b/ui/events/ozone/evdev/event_factory_evdev.h @@ -14,8 +14,8 @@ #include "ui/events/ozone/evdev/event_converter_evdev.h" #include "ui/events/ozone/evdev/event_modifiers_evdev.h" #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" -#include "ui/events/ozone/event_factory_ozone.h" #include "ui/events/platform/platform_event_source.h" +#include "ui/ozone/public/event_factory_ozone.h" namespace ui { diff --git a/ui/events/ozone/evdev/key_event_converter_evdev.cc b/ui/events/ozone/evdev/key_event_converter_evdev.cc index 2b738cf..2e6f31e 100644 --- a/ui/events/ozone/evdev/key_event_converter_evdev.cc +++ b/ui/events/ozone/evdev/key_event_converter_evdev.cc @@ -11,7 +11,7 @@ #include "ui/events/event.h" #include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/ozone/evdev/event_modifiers_evdev.h" -#include "ui/events/ozone/event_factory_ozone.h" +#include "ui/ozone/public/event_factory_ozone.h" namespace ui { diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.cc b/ui/events/ozone/evdev/touch_event_converter_evdev.cc index d02423a..9cfab5b 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc +++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc @@ -26,8 +26,8 @@ #include "ui/events/event.h" #include "ui/events/event_constants.h" #include "ui/events/event_switches.h" -#include "ui/events/ozone/event_factory_ozone.h" #include "ui/gfx/screen.h" +#include "ui/ozone/public/event_factory_ozone.h" namespace { diff --git a/ui/events/ozone/events_ozone.gyp b/ui/events/ozone/events_ozone.gyp index b3dcf3c..e20e75a 100644 --- a/ui/events/ozone/events_ozone.gyp +++ b/ui/events/ozone/events_ozone.gyp @@ -25,8 +25,6 @@ 'device/device_manager_manual.h', 'device/udev/device_manager_udev.cc', 'device/udev/device_manager_udev.h', - 'event_factory_ozone.cc', - 'event_factory_ozone.h', 'events_ozone_export.h', ], 'conditions': [ @@ -47,6 +45,7 @@ 'dependencies': [ '../../../base/base.gyp:base', '../../gfx/gfx.gyp:gfx', + '../../ozone/ozone.gyp:ozone_base', '../platform/events_platform.gyp:events_platform', 'events_ozone', ], diff --git a/ui/gfx/ozone/BUILD.gn b/ui/gfx/ozone/BUILD.gn deleted file mode 100644 index 2cac0c9..0000000 --- a/ui/gfx/ozone/BUILD.gn +++ /dev/null @@ -1,25 +0,0 @@ -# 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. - -component("ozone") { - output_name = "gfx_ozone" - saources = [ - "impl/file_surface_factory.cc", - "impl/file_surface_factory.h", - "surface_factory_ozone.cc", - "surface_factory_ozone.h", - "surface_ozone_egl.h", - "surface_ozone_canvas.h", - "overlay_candidates_ozone.cc", - "overlay_candidates_ozone.h", - ] - - defines = [ "GFX_IMPLEMENTATION" ] - - deps = [ - "//base", - "//ui/gfx/geometry", - "//skia", - ] -} diff --git a/ui/gfx/ozone/OWNERS b/ui/gfx/ozone/OWNERS deleted file mode 100644 index 77f21b5..0000000 --- a/ui/gfx/ozone/OWNERS +++ /dev/null @@ -1 +0,0 @@ -rjkroege@chromium.org diff --git a/ui/gfx/ozone/gfx_ozone.gyp b/ui/gfx/ozone/gfx_ozone.gyp deleted file mode 100644 index 3e759c8..0000000 --- a/ui/gfx/ozone/gfx_ozone.gyp +++ /dev/null @@ -1,32 +0,0 @@ -# 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. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'targets': [{ - 'target_name': 'gfx_ozone', - 'type': '<(component)', - 'defines': [ - 'GFX_IMPLEMENTATION', - ], - 'dependencies': [ - '../../../base/base.gyp:base', - '../../../skia/skia.gyp:skia', - '../gfx.gyp:gfx', - '../gfx.gyp:gfx_geometry', - ], - 'sources': [ - 'impl/file_surface_factory.cc', - 'impl/file_surface_factory.h', - 'surface_factory_ozone.cc', - 'surface_factory_ozone.h', - 'surface_ozone_egl.h', - 'surface_ozone_canvas.h', - 'overlay_candidates_ozone.cc', - 'overlay_candidates_ozone.h', - ], - }], -} diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp index 40a2ff0..59e82a6 100644 --- a/ui/gl/gl.gyp +++ b/ui/gl/gl.gyp @@ -297,7 +297,6 @@ }], ['use_ozone==1', { 'dependencies': [ - '../gfx/ozone/gfx_ozone.gyp:gfx_ozone', '../ozone/ozone.gyp:ozone', ], }], diff --git a/ui/gl/gl_implementation_ozone.cc b/ui/gl/gl_implementation_ozone.cc index 07f82d3c..ca71d75 100644 --- a/ui/gl/gl_implementation_ozone.cc +++ b/ui/gl/gl_implementation_ozone.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/bind.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context_stub_with_extensions.h" #include "ui/gl/gl_egl_api_implementation.h" @@ -12,6 +11,7 @@ #include "ui/gl/gl_implementation_osmesa.h" #include "ui/gl/gl_osmesa_api_implementation.h" #include "ui/ozone/ozone_platform.h" +#include "ui/ozone/public/surface_factory_ozone.h" namespace gfx { @@ -44,7 +44,7 @@ bool InitializeStaticGLBindings(GLImplementation implementation) { return InitializeStaticGLBindingsOSMesaGL(); case kGLImplementationEGLGLES2: ui::OzonePlatform::InitializeForGPU(); - if (!gfx::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( + if (!ui::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings( base::Bind(&AddGLNativeLibrary), base::Bind(&SetGLGetProcAddressProc))) return false; diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 3d49468..6cf3816 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc @@ -34,7 +34,7 @@ extern "C" { #endif #if defined (USE_OZONE) -#include "ui/gfx/ozone/surface_factory_ozone.h" +#include "ui/ozone/public/surface_factory_ozone.h" #endif #if !defined(EGL_FIXED_SIZE_ANGLE) @@ -129,7 +129,7 @@ bool GLSurfaceEGL::InitializeOneOff() { #if defined(USE_OZONE) const EGLint* config_attribs = - SurfaceFactoryOzone::GetInstance()->GetEGLSurfaceProperties( + ui::SurfaceFactoryOzone::GetInstance()->GetEGLSurfaceProperties( kConfigAttribs); #else const EGLint* config_attribs = kConfigAttribs; diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc index 3fa5958..4372261 100644 --- a/ui/gl/gl_surface_ozone.cc +++ b/ui/gl/gl_surface_ozone.cc @@ -7,12 +7,12 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" -#include "ui/gfx/ozone/surface_ozone_egl.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface_egl.h" #include "ui/gl/gl_surface_osmesa.h" #include "ui/gl/gl_surface_stub.h" +#include "ui/ozone/public/surface_factory_ozone.h" +#include "ui/ozone/public/surface_ozone_egl.h" namespace gfx { @@ -21,7 +21,7 @@ namespace { // A thin wrapper around GLSurfaceEGL that owns the EGLNativeWindow class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { public: - GLSurfaceOzoneEGL(scoped_ptr<SurfaceOzoneEGL> ozone_surface) + GLSurfaceOzoneEGL(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface) : NativeViewGLSurfaceEGL(ozone_surface->GetNativeWindow()), ozone_surface_(ozone_surface.Pass()) {} @@ -44,7 +44,7 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { } // The native surface. Deleting this is allowed to free the EGLNativeWindow. - scoped_ptr<SurfaceOzoneEGL> ozone_surface_; + scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_; DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneEGL); }; @@ -55,8 +55,8 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL { bool GLSurface::InitializeOneOffInternal() { switch (GetGLImplementation()) { case kGLImplementationEGLGLES2: - if (gfx::SurfaceFactoryOzone::GetInstance()->InitializeHardware() != - gfx::SurfaceFactoryOzone::INITIALIZED) { + if (ui::SurfaceFactoryOzone::GetInstance()->InitializeHardware() != + ui::SurfaceFactoryOzone::INITIALIZED) { LOG(ERROR) << "Ozone failed to initialize hardware"; return false; } @@ -86,8 +86,9 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( } DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); if (window != kNullAcceleratedWidget) { - scoped_ptr<SurfaceOzoneEGL> surface_ozone = - SurfaceFactoryOzone::GetInstance()->CreateEGLSurfaceForWidget(window); + scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone = + ui::SurfaceFactoryOzone::GetInstance()->CreateEGLSurfaceForWidget( + window); if (!surface_ozone) return NULL; @@ -136,7 +137,7 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( } EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { - return SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); + return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); } } // namespace gfx diff --git a/ui/ozone/ozone.gyp b/ui/ozone/ozone.gyp index 0eafee1..5a42e7c 100644 --- a/ui/ozone/ozone.gyp +++ b/ui/ozone/ozone.gyp @@ -15,6 +15,30 @@ }, 'targets': [ { + 'target_name': 'ozone_base', + 'type': '<(component)', + 'dependencies': [ + '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/skia/skia.gyp:skia', + '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', + ], + 'defines': [ + 'OZONE_BASE_IMPLEMENTATION', + ], + 'sources': [ + 'public/cursor_factory_ozone.cc', + 'public/cursor_factory_ozone.h', + 'public/event_factory_ozone.cc', + 'public/event_factory_ozone.h', + 'public/overlay_candidates_ozone.cc', + 'public/overlay_candidates_ozone.h', + 'public/surface_factory_ozone.cc', + 'public/surface_factory_ozone.h', + 'public/surface_ozone_canvas.h', + 'public/surface_ozone_egl.h', + ], + }, + { 'target_name': 'ozone', 'type': '<(component)', 'dependencies': [ @@ -23,10 +47,10 @@ '<(DEPTH)/ui/events/ozone/events_ozone.gyp:events_ozone', '<(DEPTH)/ui/gfx/gfx.gyp:gfx', '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', - '<(DEPTH)/ui/gfx/ozone/gfx_ozone.gyp:gfx_ozone', '<(DEPTH)/skia/skia.gyp:skia', '<@(external_ozone_platform_deps)', '<@(internal_ozone_platform_deps)', + 'ozone_base', ], 'defines': [ 'OZONE_IMPLEMENTATION', @@ -122,7 +146,7 @@ '<(DEPTH)/ui/display/display.gyp:display_types', ], }], - ] + ], }, { 'target_name': 'ozone_unittests', @@ -132,6 +156,7 @@ ], 'dependencies': [ 'ozone', + 'ozone_base', '../../base/base.gyp:base', '../../base/base.gyp:test_support_base', '../../testing/gtest.gyp:gtest', diff --git a/ui/ozone/ozone_base_export.h b/ui/ozone/ozone_base_export.h new file mode 100644 index 0000000..d3df39b --- /dev/null +++ b/ui/ozone/ozone_base_export.h @@ -0,0 +1,29 @@ +// Copyright 2013 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_OZONE_BASE_EXPORT_H_ +#define UI_OZONE_OZONE_BASE_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(OZONE_BASE_IMPLEMENTATION) +#define OZONE_BASE_EXPORT __declspec(dllexport) +#else +#define OZONE_BASE_EXPORT __declspec(dllimport) +#endif // defined(OZONE_BASE_IMPLEMENTATION) + +#else // defined(WIN32) +#if defined(OZONE_BASE_IMPLEMENTATION) +#define OZONE_BASE_EXPORT __attribute__((visibility("default"))) +#else +#define OZONE_BASE_EXPORT +#endif +#endif + +#else // defined(COMPONENT_BUILD) +#define OZONE_BASE_EXPORT +#endif + +#endif // UI_OZONE_OZONE_BASE_EXPORT_H_ diff --git a/ui/ozone/ozone_platform.h b/ui/ozone/ozone_platform.h index e6e2e0e..7a8c6c4 100644 --- a/ui/ozone/ozone_platform.h +++ b/ui/ozone/ozone_platform.h @@ -8,15 +8,12 @@ #include "base/memory/scoped_ptr.h" #include "ui/ozone/ozone_export.h" -namespace gfx { -class SurfaceFactoryOzone; -} - namespace ui { class CursorFactoryOzone; class EventFactoryOzone; class NativeDisplayDelegate; +class SurfaceFactoryOzone; class TouchscreenDeviceManager; // Base class for Ozone platform implementations. @@ -50,7 +47,7 @@ class OZONE_EXPORT OzonePlatform { // Factory getters to override in subclasses. The returned objects will be // injected into the appropriate layer at startup. Subclasses should not // inject these objects themselves. Ownership is retained by OzonePlatform. - virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; #if defined(OS_CHROMEOS) diff --git a/ui/ozone/platform/caca/caca_event_factory.h b/ui/ozone/platform/caca/caca_event_factory.h index b3f13d1..f732f00 100644 --- a/ui/ozone/platform/caca/caca_event_factory.h +++ b/ui/ozone/platform/caca/caca_event_factory.h @@ -7,9 +7,9 @@ #include "base/memory/ref_counted.h" #include "base/time/time.h" -#include "ui/events/ozone/event_factory_ozone.h" #include "ui/events/platform/platform_event_source.h" #include "ui/gfx/geometry/point_f.h" +#include "ui/ozone/public/event_factory_ozone.h" namespace ui { diff --git a/ui/ozone/platform/caca/caca_surface_factory.cc b/ui/ozone/platform/caca/caca_surface_factory.cc index e8988d6..58b5e64 100644 --- a/ui/ozone/platform/caca/caca_surface_factory.cc +++ b/ui/ozone/platform/caca/caca_surface_factory.cc @@ -7,10 +7,10 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkSurface.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/vsync_provider.h" #include "ui/ozone/platform/caca/caca_connection.h" +#include "ui/ozone/public/surface_ozone_canvas.h" namespace ui { @@ -18,14 +18,14 @@ namespace { const gfx::AcceleratedWidget kDefaultWidgetHandle = 1; -class CacaSurface : public gfx::SurfaceOzoneCanvas { +class CacaSurface : public ui::SurfaceOzoneCanvas { public: CacaSurface(CacaConnection* connection); virtual ~CacaSurface(); bool Initialize(); - // gfx::SurfaceOzoneCanvas overrides: + // ui::SurfaceOzoneCanvas overrides: virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE; @@ -111,7 +111,7 @@ CacaSurfaceFactory::~CacaSurfaceFactory() { ShutdownHardware(); } -gfx::SurfaceFactoryOzone::HardwareState +ui::SurfaceFactoryOzone::HardwareState CacaSurfaceFactory::InitializeHardware() { connection_->Initialize(); state_ = INITIALIZED; @@ -134,14 +134,14 @@ bool CacaSurfaceFactory::LoadEGLGLES2Bindings( return false; } -scoped_ptr<gfx::SurfaceOzoneCanvas> CacaSurfaceFactory::CreateCanvasForWidget( +scoped_ptr<ui::SurfaceOzoneCanvas> CacaSurfaceFactory::CreateCanvasForWidget( gfx::AcceleratedWidget widget) { CHECK_EQ(INITIALIZED, state_); CHECK_EQ(kDefaultWidgetHandle, widget); scoped_ptr<CacaSurface> canvas(new CacaSurface(connection_)); CHECK(canvas->Initialize()); - return canvas.PassAs<gfx::SurfaceOzoneCanvas>(); + return canvas.PassAs<ui::SurfaceOzoneCanvas>(); } } // namespace ui diff --git a/ui/ozone/platform/caca/caca_surface_factory.h b/ui/ozone/platform/caca/caca_surface_factory.h index c3db5fd..a07033a 100644 --- a/ui/ozone/platform/caca/caca_surface_factory.h +++ b/ui/ozone/platform/caca/caca_surface_factory.h @@ -8,7 +8,7 @@ #include <caca.h> #include "base/memory/scoped_ptr.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" +#include "ui/ozone/public/surface_factory_ozone.h" namespace gfx { class SurfaceOzone; @@ -18,19 +18,19 @@ namespace ui { class CacaConnection; -class CacaSurfaceFactory : public gfx::SurfaceFactoryOzone { +class CacaSurfaceFactory : public ui::SurfaceFactoryOzone { public: CacaSurfaceFactory(CacaConnection* connection); virtual ~CacaSurfaceFactory(); - // gfx::SurfaceFactoryOzone overrides: + // ui::SurfaceFactoryOzone overrides: virtual HardwareState InitializeHardware() OVERRIDE; virtual void ShutdownHardware() OVERRIDE; virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; - virtual scoped_ptr<gfx::SurfaceOzoneCanvas> CreateCanvasForWidget( + virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget( gfx::AcceleratedWidget widget) OVERRIDE; private: diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/caca/ozone_platform_caca.cc index a74379b..16adec8 100644 --- a/ui/ozone/platform/caca/ozone_platform_caca.cc +++ b/ui/ozone/platform/caca/ozone_platform_caca.cc @@ -4,11 +4,11 @@ #include "ui/ozone/platform/caca/ozone_platform_caca.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" #include "ui/ozone/ozone_platform.h" #include "ui/ozone/platform/caca/caca_connection.h" #include "ui/ozone/platform/caca/caca_event_factory.h" #include "ui/ozone/platform/caca/caca_surface_factory.h" +#include "ui/ozone/public/cursor_factory_ozone.h" #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" @@ -25,7 +25,7 @@ class OzonePlatformCaca : public OzonePlatform { virtual ~OzonePlatformCaca() {} // OzonePlatform: - virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { return surface_factory_ozone_.get(); } virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { diff --git a/ui/ozone/platform/dri/dri.gypi b/ui/ozone/platform/dri/dri.gypi index 7faa322..3e10ca7 100644 --- a/ui/ozone/platform/dri/dri.gypi +++ b/ui/ozone/platform/dri/dri.gypi @@ -29,7 +29,6 @@ '../events/ozone/events_ozone.gyp:events_ozone_evdev', '../gfx/gfx.gyp:gfx', '../gfx/gfx.gyp:gfx_geometry', - '../gfx/ozone/gfx_ozone.gyp:gfx_ozone', ], 'defines': [ 'OZONE_IMPLEMENTATION', @@ -73,13 +72,11 @@ '../../build/linux/system.gyp:dridrm', '../../skia/skia.gyp:skia', '../gfx/gfx.gyp:gfx_geometry', - '../gfx/ozone/gfx_ozone.gyp:gfx_ozone', ], 'export_dependent_settings': [ '../../build/linux/system.gyp:dridrm', '../../skia/skia.gyp:skia', '../gfx/gfx.gyp:gfx_geometry', - '../gfx/ozone/gfx_ozone.gyp:gfx_ozone', ], 'direct_dependent_settings': { 'sources': [ diff --git a/ui/ozone/platform/dri/dri_surface_factory.cc b/ui/ozone/platform/dri/dri_surface_factory.cc index 71cb4ce..bbfb6e2 100644 --- a/ui/ozone/platform/dri/dri_surface_factory.cc +++ b/ui/ozone/platform/dri/dri_surface_factory.cc @@ -12,13 +12,13 @@ #include "third_party/skia/include/core/SkDevice.h" #include "third_party/skia/include/core/SkSurface.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" #include "ui/ozone/platform/dri/dri_surface.h" #include "ui/ozone/platform/dri/dri_util.h" #include "ui/ozone/platform/dri/dri_vsync_provider.h" #include "ui/ozone/platform/dri/dri_wrapper.h" #include "ui/ozone/platform/dri/hardware_display_controller.h" #include "ui/ozone/platform/dri/screen_manager.h" +#include "ui/ozone/public/surface_ozone_canvas.h" namespace ui { @@ -42,7 +42,7 @@ void UpdateCursorImage(DriSurface* cursor, const SkBitmap& image) { canvas->drawBitmapRectToRect(image, &damage, damage); } -class DriSurfaceAdapter : public gfx::SurfaceOzoneCanvas { +class DriSurfaceAdapter : public ui::SurfaceOzoneCanvas { public: DriSurfaceAdapter(const base::WeakPtr<HardwareDisplayController>& controller); virtual ~DriSurfaceAdapter(); @@ -128,8 +128,7 @@ DriSurfaceFactory::~DriSurfaceFactory() { ShutdownHardware(); } -gfx::SurfaceFactoryOzone::HardwareState -DriSurfaceFactory::InitializeHardware() { +ui::SurfaceFactoryOzone::HardwareState DriSurfaceFactory::InitializeHardware() { if (state_ != UNINITIALIZED) return state_; @@ -163,13 +162,13 @@ gfx::AcceleratedWidget DriSurfaceFactory::GetAcceleratedWidget() { return ++allocated_widgets_; } -scoped_ptr<gfx::SurfaceOzoneCanvas> DriSurfaceFactory::CreateCanvasForWidget( +scoped_ptr<ui::SurfaceOzoneCanvas> DriSurfaceFactory::CreateCanvasForWidget( gfx::AcceleratedWidget w) { CHECK(state_ == INITIALIZED); // Initial cursor set. ResetCursor(w); - return scoped_ptr<gfx::SurfaceOzoneCanvas>( + return scoped_ptr<ui::SurfaceOzoneCanvas>( new DriSurfaceAdapter(screen_manager_->GetDisplayController(w))); } diff --git a/ui/ozone/platform/dri/dri_surface_factory.h b/ui/ozone/platform/dri/dri_surface_factory.h index f26b9ed..69ec5df 100644 --- a/ui/ozone/platform/dri/dri_surface_factory.h +++ b/ui/ozone/platform/dri/dri_surface_factory.h @@ -9,8 +9,8 @@ #include "base/memory/scoped_ptr.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" #include "ui/ozone/ozone_export.h" +#include "ui/ozone/public/surface_factory_ozone.h" typedef struct _drmModeModeInfo drmModeModeInfo; @@ -28,7 +28,7 @@ class ScreenManager; // SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers. // This implementation is used in conjunction with the software rendering // path. -class OZONE_EXPORT DriSurfaceFactory : public gfx::SurfaceFactoryOzone { +class OZONE_EXPORT DriSurfaceFactory : public ui::SurfaceFactoryOzone { public: static const gfx::AcceleratedWidget kDefaultWidgetHandle; @@ -41,7 +41,7 @@ class OZONE_EXPORT DriSurfaceFactory : public gfx::SurfaceFactoryOzone { virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual scoped_ptr<gfx::SurfaceOzoneCanvas> CreateCanvasForWidget( + virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget( gfx::AcceleratedWidget w) OVERRIDE; virtual bool LoadEGLGLES2Bindings( diff --git a/ui/ozone/platform/dri/dri_surface_factory_unittest.cc b/ui/ozone/platform/dri/dri_surface_factory_unittest.cc index 4b0e12a..13d81cb 100644 --- a/ui/ozone/platform/dri/dri_surface_factory_unittest.cc +++ b/ui/ozone/platform/dri/dri_surface_factory_unittest.cc @@ -10,8 +10,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkImageInfo.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" #include "ui/ozone/platform/dri/dri_buffer.h" #include "ui/ozone/platform/dri/dri_surface.h" #include "ui/ozone/platform/dri/dri_surface_factory.h" @@ -20,6 +18,8 @@ #include "ui/ozone/platform/dri/test/mock_dri_surface.h" #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h" #include "ui/ozone/platform/dri/test/mock_surface_generator.h" +#include "ui/ozone/public/surface_factory_ozone.h" +#include "ui/ozone/public/surface_ozone_canvas.h" namespace { @@ -109,16 +109,16 @@ void DriSurfaceFactoryTest::TearDown() { TEST_F(DriSurfaceFactoryTest, FailInitialization) { dri_->fail_init(); - EXPECT_EQ(gfx::SurfaceFactoryOzone::FAILED, factory_->InitializeHardware()); + EXPECT_EQ(ui::SurfaceFactoryOzone::FAILED, factory_->InitializeHardware()); } TEST_F(DriSurfaceFactoryTest, SuccessfulInitialization) { - EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, + EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, factory_->InitializeHardware()); } TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) { - EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, + EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, factory_->InitializeHardware()); gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); @@ -128,13 +128,13 @@ TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) { } TEST_F(DriSurfaceFactoryTest, CheckNativeSurfaceContents) { - EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, + EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, factory_->InitializeHardware()); gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); EXPECT_EQ(ui::DriSurfaceFactory::kDefaultWidgetHandle, w); - scoped_ptr<gfx::SurfaceOzoneCanvas> surface = + scoped_ptr<ui::SurfaceOzoneCanvas> surface = factory_->CreateCanvasForWidget(w); surface->ResizeCanvas( @@ -161,13 +161,13 @@ TEST_F(DriSurfaceFactoryTest, CheckNativeSurfaceContents) { } TEST_F(DriSurfaceFactoryTest, SetCursorImage) { - EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, + EXPECT_EQ(ui::SurfaceFactoryOzone::INITIALIZED, factory_->InitializeHardware()); gfx::AcceleratedWidget w = factory_->GetAcceleratedWidget(); EXPECT_EQ(ui::DriSurfaceFactory::kDefaultWidgetHandle, w); - scoped_ptr<gfx::SurfaceOzoneCanvas> surf = factory_->CreateCanvasForWidget(w); + scoped_ptr<ui::SurfaceOzoneCanvas> surf = factory_->CreateCanvasForWidget(w); EXPECT_TRUE(surf); SkBitmap image; diff --git a/ui/ozone/platform/dri/gbm_surface_factory.cc b/ui/ozone/platform/dri/gbm_surface_factory.cc index eea2173..5eb93fc 100644 --- a/ui/ozone/platform/dri/gbm_surface_factory.cc +++ b/ui/ozone/platform/dri/gbm_surface_factory.cc @@ -8,19 +8,19 @@ #include <gbm.h> #include "base/files/file_path.h" -#include "ui/gfx/ozone/surface_ozone_egl.h" #include "ui/ozone/platform/dri/buffer_data.h" #include "ui/ozone/platform/dri/dri_vsync_provider.h" #include "ui/ozone/platform/dri/gbm_surface.h" #include "ui/ozone/platform/dri/hardware_display_controller.h" #include "ui/ozone/platform/dri/scanout_surface.h" #include "ui/ozone/platform/dri/screen_manager.h" +#include "ui/ozone/public/surface_ozone_egl.h" namespace ui { namespace { -class GbmSurfaceAdapter : public gfx::SurfaceOzoneEGL { +class GbmSurfaceAdapter : public ui::SurfaceOzoneEGL { public: GbmSurfaceAdapter(const base::WeakPtr<HardwareDisplayController>& controller); virtual ~GbmSurfaceAdapter(); @@ -143,12 +143,12 @@ bool GbmSurfaceFactory::LoadEGLGLES2Bindings( return true; } -scoped_ptr<gfx::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( +scoped_ptr<ui::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( gfx::AcceleratedWidget w) { CHECK(state_ == INITIALIZED); ResetCursor(w); - return scoped_ptr<gfx::SurfaceOzoneEGL>( + return scoped_ptr<ui::SurfaceOzoneEGL>( new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w))); } diff --git a/ui/ozone/platform/dri/gbm_surface_factory.h b/ui/ozone/platform/dri/gbm_surface_factory.h index 6428241..da624bf 100644 --- a/ui/ozone/platform/dri/gbm_surface_factory.h +++ b/ui/ozone/platform/dri/gbm_surface_factory.h @@ -25,7 +25,7 @@ class GbmSurfaceFactory : public DriSurfaceFactory { virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; - virtual scoped_ptr<gfx::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( + virtual scoped_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( gfx::AcceleratedWidget w) OVERRIDE; virtual gfx::NativeBufferOzone CreateNativeBuffer( gfx::Size size, diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc index 4d77c35..9d0a986 100644 --- a/ui/ozone/platform/dri/ozone_platform_dri.cc +++ b/ui/ozone/platform/dri/ozone_platform_dri.cc @@ -62,7 +62,7 @@ class OzonePlatformDri : public OzonePlatform { virtual ~OzonePlatformDri() {} // OzonePlatform: - virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { return surface_factory_ozone_.get(); } virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { diff --git a/ui/ozone/platform/dri/ozone_platform_gbm.cc b/ui/ozone/platform/dri/ozone_platform_gbm.cc index 4e47a28..6710380 100644 --- a/ui/ozone/platform/dri/ozone_platform_gbm.cc +++ b/ui/ozone/platform/dri/ozone_platform_gbm.cc @@ -5,11 +5,10 @@ #include "ui/ozone/platform/dri/ozone_platform_gbm.h" #include <dlfcn.h> -#include <stdlib.h> #include <gbm.h> +#include <stdlib.h> #include "base/at_exit.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" #include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/ozone/ozone_platform.h" @@ -19,6 +18,7 @@ #include "ui/ozone/platform/dri/scanout_surface.h" #include "ui/ozone/platform/dri/screen_manager.h" #include "ui/ozone/platform/dri/virtual_terminal_manager.h" +#include "ui/ozone/public/cursor_factory_ozone.h" #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" @@ -69,7 +69,7 @@ class OzonePlatformGbm : public OzonePlatform { virtual ~OzonePlatformGbm() {} // OzonePlatform: - virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { return surface_factory_ozone_.get(); } virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc index 1a93997..84c2b8c 100644 --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc +++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc @@ -9,14 +9,14 @@ #include "base/files/file_path.h" #include "base/path_service.h" #include "library_loaders/libeglplatform_shim.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" #include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/evdev/event_factory_evdev.h" -#include "ui/gfx/ozone/impl/file_surface_factory.h" -#include "ui/gfx/ozone/surface_ozone_egl.h" #include "ui/gfx/vsync_provider.h" #include "ui/ozone/ozone_platform.h" #include "ui/ozone/ozone_switches.h" +#include "ui/ozone/platform/test/file_surface_factory.h" +#include "ui/ozone/public/cursor_factory_ozone.h" +#include "ui/ozone/public/surface_ozone_egl.h" #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" @@ -47,7 +47,7 @@ std::string GetShimLibraryName() { // // This just manages the native window lifetime using // ShimGetNativeWindow & ShimReleaseNativeWindow. -class SurfaceOzoneEgltest : public gfx::SurfaceOzoneEGL { +class SurfaceOzoneEgltest : public SurfaceOzoneEGL { public: SurfaceOzoneEgltest(ShimNativeWindowId window_id, LibeglplatformShimLoader* eglplatform_shim) @@ -80,7 +80,7 @@ class SurfaceOzoneEgltest : public gfx::SurfaceOzoneEGL { // This finds the right EGL/GLES2 libraries for loading, and creates // a single native window via ShimCreateWindow for drawing // into. -class SurfaceFactoryEgltest : public gfx::SurfaceFactoryOzone { +class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone { public: SurfaceFactoryEgltest(LibeglplatformShimLoader* eglplatform_shim) : eglplatform_shim_(eglplatform_shim), window_id_(SHIM_NO_WINDOW_ID) {} @@ -95,7 +95,7 @@ class SurfaceFactoryEgltest : public gfx::SurfaceFactoryOzone { virtual void ShutdownHardware() OVERRIDE; virtual intptr_t GetNativeDisplay() OVERRIDE; virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual scoped_ptr<gfx::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( + virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( gfx::AcceleratedWidget widget) OVERRIDE; virtual const int32* GetEGLSurfaceProperties( const int32* desired_list) OVERRIDE; @@ -138,10 +138,9 @@ gfx::AcceleratedWidget SurfaceFactoryEgltest::GetAcceleratedWidget() { return window_id_; } -scoped_ptr<gfx::SurfaceOzoneEGL> -SurfaceFactoryEgltest::CreateEGLSurfaceForWidget( +scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryEgltest::CreateEGLSurfaceForWidget( gfx::AcceleratedWidget widget) { - return make_scoped_ptr<gfx::SurfaceOzoneEGL>( + return make_scoped_ptr<SurfaceOzoneEGL>( new SurfaceOzoneEgltest(widget, eglplatform_shim_)); } @@ -236,7 +235,7 @@ class OzonePlatformEgltest : public OzonePlatform { } // OzonePlatform: - virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { return surface_factory_ozone_.get(); } virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { diff --git a/ui/ozone/platform/test/DEPS b/ui/ozone/platform/test/DEPS new file mode 100644 index 0000000..41cd997 --- /dev/null +++ b/ui/ozone/platform/test/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+third_party/skia/include", +] diff --git a/ui/gfx/ozone/impl/file_surface_factory.cc b/ui/ozone/platform/test/file_surface_factory.cc index ca7dfaf..ab1e67c 100644 --- a/ui/gfx/ozone/impl/file_surface_factory.cc +++ b/ui/ozone/platform/test/file_surface_factory.cc @@ -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 "ui/gfx/ozone/impl/file_surface_factory.h" +#include "ui/ozone/platform/test/file_surface_factory.h" #include "base/bind.h" #include "base/file_util.h" @@ -12,16 +12,15 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkSurface.h" #include "ui/gfx/codec/png_codec.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/vsync_provider.h" +#include "ui/ozone/public/surface_ozone_canvas.h" -namespace gfx { +namespace ui { namespace { -void WriteDataToFile(const base::FilePath& location, - const SkBitmap& bitmap) { +void WriteDataToFile(const base::FilePath& location, const SkBitmap& bitmap) { std::vector<unsigned char> png_data; gfx::PNGCodec::FastEncodeBGRASkBitmap(bitmap, true, &png_data); base::WriteFile(location, @@ -35,10 +34,9 @@ class FileSurface : public SurfaceOzoneCanvas { virtual ~FileSurface() {} // SurfaceOzoneCanvas overrides: - virtual void ResizeCanvas(const Size& viewport_size) OVERRIDE { - surface_ = skia::AdoptRef(SkSurface::NewRaster( - SkImageInfo::MakeN32Premul(viewport_size.width(), - viewport_size.height()))); + virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE { + surface_ = skia::AdoptRef(SkSurface::NewRaster(SkImageInfo::MakeN32Premul( + viewport_size.width(), viewport_size.height()))); } virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { return skia::SharePtr(surface_->getCanvas()); @@ -65,37 +63,36 @@ class FileSurface : public SurfaceOzoneCanvas { } // namespace -FileSurfaceFactory::FileSurfaceFactory( - const base::FilePath& dump_location) +FileSurfaceFactory::FileSurfaceFactory(const base::FilePath& dump_location) : location_(dump_location) { - CHECK(!base::DirectoryExists(location_)) - << "Location cannot be a directory (" << location_.value() << ")"; + CHECK(!base::DirectoryExists(location_)) << "Location cannot be a directory (" + << location_.value() << ")"; CHECK(!base::PathExists(location_) || base::PathIsWritable(location_)); } -FileSurfaceFactory::~FileSurfaceFactory() {} +FileSurfaceFactory::~FileSurfaceFactory() { +} -SurfaceFactoryOzone::HardwareState -FileSurfaceFactory::InitializeHardware() { +SurfaceFactoryOzone::HardwareState FileSurfaceFactory::InitializeHardware() { return INITIALIZED; } void FileSurfaceFactory::ShutdownHardware() { } -AcceleratedWidget FileSurfaceFactory::GetAcceleratedWidget() { +gfx::AcceleratedWidget FileSurfaceFactory::GetAcceleratedWidget() { return 1; } scoped_ptr<SurfaceOzoneCanvas> FileSurfaceFactory::CreateCanvasForWidget( - gfx::AcceleratedWidget w) { + gfx::AcceleratedWidget w) { return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(location_)); } bool FileSurfaceFactory::LoadEGLGLES2Bindings( - AddGLLibraryCallback add_gl_library, - SetGLGetProcAddressProcCallback set_gl_get_proc_address) { + AddGLLibraryCallback add_gl_library, + SetGLGetProcAddressProcCallback set_gl_get_proc_address) { return false; } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/ozone/impl/file_surface_factory.h b/ui/ozone/platform/test/file_surface_factory.h index 08c2b90..54ab104 100644 --- a/ui/gfx/ozone/impl/file_surface_factory.h +++ b/ui/ozone/platform/test/file_surface_factory.h @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_H_ -#define UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_H_ +#ifndef UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ +#define UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "ui/gfx/native_widget_types.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" +#include "ui/ozone/public/surface_factory_ozone.h" -namespace gfx { +namespace ui { -class GFX_EXPORT FileSurfaceFactory : public SurfaceFactoryOzone { +class OZONE_BASE_EXPORT FileSurfaceFactory : public SurfaceFactoryOzone { public: explicit FileSurfaceFactory(const base::FilePath& dump_location); virtual ~FileSurfaceFactory(); @@ -21,7 +21,7 @@ class GFX_EXPORT FileSurfaceFactory : public SurfaceFactoryOzone { // SurfaceFactoryOzone: virtual HardwareState InitializeHardware() OVERRIDE; virtual void ShutdownHardware() OVERRIDE; - virtual AcceleratedWidget GetAcceleratedWidget() OVERRIDE; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( gfx::AcceleratedWidget w) OVERRIDE; virtual bool LoadEGLGLES2Bindings( @@ -33,6 +33,6 @@ class GFX_EXPORT FileSurfaceFactory : public SurfaceFactoryOzone { DISALLOW_COPY_AND_ASSIGN(FileSurfaceFactory); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_H_ +#endif // UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/test/ozone_platform_test.cc index d655fa7..b6339d6 100644 --- a/ui/ozone/platform/test/ozone_platform_test.cc +++ b/ui/ozone/platform/test/ozone_platform_test.cc @@ -6,12 +6,12 @@ #include "base/command_line.h" #include "base/files/file_path.h" -#include "ui/base/cursor/ozone/cursor_factory_ozone.h" #include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/evdev/event_factory_evdev.h" -#include "ui/gfx/ozone/impl/file_surface_factory.h" #include "ui/ozone/ozone_platform.h" #include "ui/ozone/ozone_switches.h" +#include "ui/ozone/platform/test/file_surface_factory.h" +#include "ui/ozone/public/cursor_factory_ozone.h" #if defined(OS_CHROMEOS) #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" @@ -31,7 +31,7 @@ class OzonePlatformTest : public OzonePlatform { virtual ~OzonePlatformTest() {} // OzonePlatform: - virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { return surface_factory_ozone_.get(); } virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { @@ -55,7 +55,7 @@ class OzonePlatformTest : public OzonePlatform { virtual void InitializeUI() OVERRIDE { device_manager_ = CreateDeviceManager(); - surface_factory_ozone_.reset(new gfx::FileSurfaceFactory(file_path_)); + surface_factory_ozone_.reset(new FileSurfaceFactory(file_path_)); event_factory_ozone_.reset( new EventFactoryEvdev(NULL, device_manager_.get())); cursor_factory_ozone_.reset(new CursorFactoryOzone()); @@ -65,7 +65,7 @@ class OzonePlatformTest : public OzonePlatform { private: scoped_ptr<DeviceManager> device_manager_; - scoped_ptr<gfx::FileSurfaceFactory> surface_factory_ozone_; + scoped_ptr<FileSurfaceFactory> surface_factory_ozone_; scoped_ptr<EventFactoryEvdev> event_factory_ozone_; scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; base::FilePath file_path_; diff --git a/ui/ozone/platform/test/test.gypi b/ui/ozone/platform/test/test.gypi index 09a7aa6..c75c840 100644 --- a/ui/ozone/platform/test/test.gypi +++ b/ui/ozone/platform/test/test.gypi @@ -25,6 +25,8 @@ '../gfx/gfx.gyp:gfx', ], 'sources': [ + 'file_surface_factory.cc', + 'file_surface_factory.h', 'ozone_platform_test.cc', 'ozone_platform_test.h', ], diff --git a/ui/ozone/public/DEPS b/ui/ozone/public/DEPS new file mode 100644 index 0000000..717f3ae --- /dev/null +++ b/ui/ozone/public/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+skia/ext", +] diff --git a/ui/base/cursor/ozone/cursor_factory_ozone.cc b/ui/ozone/public/cursor_factory_ozone.cc index 51fd7f8..c50f55e 100644 --- a/ui/base/cursor/ozone/cursor_factory_ozone.cc +++ b/ui/ozone/public/cursor_factory_ozone.cc @@ -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 "ui/base/cursor/ozone/cursor_factory_ozone.h" +#include "ui/ozone/public/cursor_factory_ozone.h" #include "base/logging.h" diff --git a/ui/base/cursor/ozone/cursor_factory_ozone.h b/ui/ozone/public/cursor_factory_ozone.h index 23ac113..5c04484 100644 --- a/ui/base/cursor/ozone/cursor_factory_ozone.h +++ b/ui/ozone/public/cursor_factory_ozone.h @@ -2,16 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_BASE_CURSOR_OZONE_CURSOR_FACTORY_OZONE_H_ -#define UI_BASE_CURSOR_OZONE_CURSOR_FACTORY_OZONE_H_ +#ifndef UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_ +#define UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_ -#include "ui/base/cursor/cursor.h" -#include "ui/base/ui_base_export.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ozone/ozone_base_export.h" + +namespace gfx { +class Point; +} namespace ui { -class UI_BASE_EXPORT CursorFactoryOzone { +typedef void* PlatformCursor; + +class OZONE_BASE_EXPORT CursorFactoryOzone { public: CursorFactoryOzone(); virtual ~CursorFactoryOzone(); @@ -49,6 +54,6 @@ class UI_BASE_EXPORT CursorFactoryOzone { static CursorFactoryOzone* impl_; // not owned }; -} // namespace gfx +} // namespace ui -#endif // UI_BASE_CURSOR_OZONE_CURSOR_FACTORY_OZONE_H_ +#endif // UI_OZONE_PUBLIC_CURSOR_FACTORY_OZONE_H_ diff --git a/ui/events/ozone/event_factory_ozone.cc b/ui/ozone/public/event_factory_ozone.cc index 79d6ece..85ecf3c 100644 --- a/ui/events/ozone/event_factory_ozone.cc +++ b/ui/ozone/public/event_factory_ozone.cc @@ -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 "ui/events/ozone/event_factory_ozone.h" +#include "ui/ozone/public/event_factory_ozone.h" #include "base/logging.h" diff --git a/ui/events/ozone/event_factory_ozone.h b/ui/ozone/public/event_factory_ozone.h index 882ebb1..bbca9fd 100644 --- a/ui/events/ozone/event_factory_ozone.h +++ b/ui/ozone/public/event_factory_ozone.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ -#define UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ +#ifndef UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ +#define UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ #include <map> #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_pump_libevent.h" -#include "ui/events/ozone/events_ozone_export.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ozone/ozone_base_export.h" namespace gfx { class PointF; @@ -25,7 +25,7 @@ class Event; // Ozone presumes that the set of file descriptors can vary at runtime so this // class supports dynamically adding and removing |EventConverterOzone| // instances as necessary. -class EVENTS_OZONE_EXPORT EventFactoryOzone { +class OZONE_BASE_EXPORT EventFactoryOzone { public: EventFactoryOzone(); virtual ~EventFactoryOzone(); @@ -47,4 +47,4 @@ class EVENTS_OZONE_EXPORT EventFactoryOzone { } // namespace ui -#endif // UI_EVENTS_OZONE_EVENT_FACTORY_OZONE_H_ +#endif // UI_OZONE_PUBLIC_EVENT_FACTORY_OZONE_H_ diff --git a/ui/gfx/ozone/overlay_candidates_ozone.cc b/ui/ozone/public/overlay_candidates_ozone.cc index ddf92ac..006f4b2 100644 --- a/ui/gfx/ozone/overlay_candidates_ozone.cc +++ b/ui/ozone/public/overlay_candidates_ozone.cc @@ -2,24 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/ozone/overlay_candidates_ozone.h" +#include "ui/ozone/public/overlay_candidates_ozone.h" #include <stdlib.h> -namespace gfx { +namespace ui { OverlayCandidatesOzone::OverlaySurfaceCandidate::OverlaySurfaceCandidate() : transform(gfx::OVERLAY_TRANSFORM_NONE), format(SurfaceFactoryOzone::UNKNOWN), - overlay_handled(false) {} + overlay_handled(false) { +} -OverlayCandidatesOzone::OverlaySurfaceCandidate::~OverlaySurfaceCandidate() {} +OverlayCandidatesOzone::OverlaySurfaceCandidate::~OverlaySurfaceCandidate() { +} void OverlayCandidatesOzone::CheckOverlaySupport( OverlaySurfaceCandidateList* surfaces) { NOTREACHED(); } -OverlayCandidatesOzone::~OverlayCandidatesOzone() {} +OverlayCandidatesOzone::~OverlayCandidatesOzone() { +} -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/ozone/overlay_candidates_ozone.h b/ui/ozone/public/overlay_candidates_ozone.h index da8a4bb..e33de56 100644 --- a/ui/gfx/ozone/overlay_candidates_ozone.h +++ b/ui/ozone/public/overlay_candidates_ozone.h @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_OZONE_OVERLAY_CANDIDATES_OZONE_H_ -#define UI_GFX_OZONE_OVERLAY_CANDIDATES_OZONE_H_ +#ifndef UI_OZONE_PUBLIC_OVERLAY_CANDIDATES_OZONE_H_ +#define UI_OZONE_PUBLIC_OVERLAY_CANDIDATES_OZONE_H_ #include <vector> #include "base/basictypes.h" -#include "ui/gfx/gfx_export.h" -#include "ui/gfx/ozone/surface_factory_ozone.h" #include "ui/gfx/rect_f.h" +#include "ui/ozone/ozone_base_export.h" +#include "ui/ozone/public/surface_factory_ozone.h" -namespace gfx { +namespace ui { // This class can be used to answer questions about possible overlay // configurations for a particular output device. We get an instance of this // class from SurfaceFactoryOzone given an AcceleratedWidget. -class GFX_EXPORT OverlayCandidatesOzone { +class OZONE_BASE_EXPORT OverlayCandidatesOzone { public: struct OverlaySurfaceCandidate { OverlaySurfaceCandidate(); @@ -51,6 +51,6 @@ class GFX_EXPORT OverlayCandidatesOzone { virtual ~OverlayCandidatesOzone(); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_OZONE_OVERLAY_CANDIDATES_OZONE_H_ +#endif // UI_OZONE_PUBLIC_OVERLAY_CANDIDATES_OZONE_H_ diff --git a/ui/gfx/ozone/surface_factory_ozone.cc b/ui/ozone/public/surface_factory_ozone.cc index a1dbdd1..9d33be4 100644 --- a/ui/gfx/ozone/surface_factory_ozone.cc +++ b/ui/ozone/public/surface_factory_ozone.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/ozone/surface_factory_ozone.h" +#include "ui/ozone/public/surface_factory_ozone.h" #include <stdlib.h> #include "base/command_line.h" -#include "ui/gfx/ozone/surface_ozone_canvas.h" -#include "ui/gfx/ozone/surface_ozone_egl.h" +#include "ui/ozone/public/surface_ozone_canvas.h" +#include "ui/ozone/public/surface_ozone_egl.h" -namespace gfx { +namespace ui { // static SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL; @@ -35,13 +35,13 @@ intptr_t SurfaceFactoryOzone::GetNativeDisplay() { } scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryOzone::CreateEGLSurfaceForWidget( - gfx::AcceleratedWidget widget) { + gfx::AcceleratedWidget widget) { NOTIMPLEMENTED(); return scoped_ptr<SurfaceOzoneEGL>(); } scoped_ptr<SurfaceOzoneCanvas> SurfaceFactoryOzone::CreateCanvasForWidget( - gfx::AcceleratedWidget widget) { + gfx::AcceleratedWidget widget) { NOTIMPLEMENTED(); return scoped_ptr<SurfaceOzoneCanvas>(); } @@ -51,8 +51,7 @@ const int32* SurfaceFactoryOzone::GetEGLSurfaceProperties( return desired_attributes; } - -gfx::OverlayCandidatesOzone* SurfaceFactoryOzone::GetOverlayCandidates( +ui::OverlayCandidatesOzone* SurfaceFactoryOzone::GetOverlayCandidates( gfx::AcceleratedWidget w) { return NULL; } @@ -61,16 +60,16 @@ void SurfaceFactoryOzone::ScheduleOverlayPlane( gfx::AcceleratedWidget w, int plane_z_order, gfx::OverlayTransform plane_transform, - gfx::NativeBufferOzone buffer, + ui::NativeBufferOzone buffer, const gfx::Rect& display_bounds, gfx::RectF crop_rect) { NOTREACHED(); } -gfx::NativeBufferOzone SurfaceFactoryOzone::CreateNativeBuffer( +ui::NativeBufferOzone SurfaceFactoryOzone::CreateNativeBuffer( gfx::Size size, BufferFormat format) { return 0; } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/ozone/surface_factory_ozone.h b/ui/ozone/public/surface_factory_ozone.h index b7eb83b..4702d69 100644 --- a/ui/gfx/ozone/surface_factory_ozone.h +++ b/ui/ozone/public/surface_factory_ozone.h @@ -2,28 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ -#define UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ +#ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ +#define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "base/native_library.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" -#include "ui/gfx/gfx_export.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/overlay_transform.h" #include "ui/gfx/rect.h" +#include "ui/ozone/ozone_base_export.h" class SkBitmap; class SkCanvas; -namespace gfx { -class VSyncProvider; +namespace ui { + +typedef intptr_t NativeBufferOzone; class OverlayCandidatesOzone; class SurfaceOzoneCanvas; class SurfaceOzoneEGL; -typedef intptr_t NativeBufferOzone; // The Ozone interface allows external implementations to hook into Chromium to // provide a system specific implementation. The Ozone interface supports two @@ -56,7 +56,7 @@ typedef intptr_t NativeBufferOzone; // // The remaining functions are not covered since they are needed in both drawing // modes (See comments bellow for descriptions). -class GFX_EXPORT SurfaceFactoryOzone { +class OZONE_BASE_EXPORT SurfaceFactoryOzone { public: // Describes the state of the hardware after initialization. enum HardwareState { @@ -74,7 +74,7 @@ class GFX_EXPORT SurfaceFactoryOzone { RGB_888, }; - typedef void*(*GLGetProcAddressProc)(const char* name); + typedef void* (*GLGetProcAddressProc)(const char* name); typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; typedef base::Callback<void(GLGetProcAddressProc)> SetGLGetProcAddressProcCallback; @@ -108,14 +108,14 @@ class GFX_EXPORT SurfaceFactoryOzone { // platform must support creation of SurfaceOzoneEGL from the GPU process // using only the handle contained in gfx::AcceleratedWidget. virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( - gfx::AcceleratedWidget widget); + gfx::AcceleratedWidget widget); // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget. // // Note: The platform must support creation of SurfaceOzoneCanvas from the // Browser Process using only the handle contained in gfx::AcceleratedWidget. virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( - gfx::AcceleratedWidget widget); + gfx::AcceleratedWidget widget); // Sets up GL bindings for the native surface. Takes two callback parameters // that allow Ozone to register the GL bindings. @@ -131,7 +131,7 @@ class GFX_EXPORT SurfaceFactoryOzone { virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); // Get the hal struct to check for overlay support. - virtual gfx::OverlayCandidatesOzone* GetOverlayCandidates( + virtual OverlayCandidatesOzone* GetOverlayCandidates( gfx::AcceleratedWidget w); // Sets the overlay plane to switch to at the next page flip. @@ -146,18 +146,18 @@ class GFX_EXPORT SurfaceFactoryOzone { virtual void ScheduleOverlayPlane(gfx::AcceleratedWidget w, int plane_z_order, gfx::OverlayTransform plane_transform, - gfx::NativeBufferOzone buffer, + ui::NativeBufferOzone buffer, const gfx::Rect& display_bounds, gfx::RectF crop_rect); // Cleate a single native buffer to be used for overlay planes. - virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, - BufferFormat format); + virtual ui::NativeBufferOzone CreateNativeBuffer(gfx::Size size, + BufferFormat format); private: - static SurfaceFactoryOzone* impl_; // not owned + static SurfaceFactoryOzone* impl_; // not owned }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ +#endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ diff --git a/ui/gfx/ozone/surface_ozone_canvas.h b/ui/ozone/public/surface_ozone_canvas.h index efedf90..d02338b 100644 --- a/ui/gfx/ozone/surface_ozone_canvas.h +++ b/ui/ozone/public/surface_ozone_canvas.h @@ -2,26 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_OZONE_SURFACE_OZONE_CANVAS_H_ -#define UI_GFX_OZONE_SURFACE_OZONE_CANVAS_H_ +#ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ +#define UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "skia/ext/refptr.h" -#include "ui/gfx/gfx_export.h" +#include "ui/ozone/ozone_base_export.h" class SkCanvas; namespace gfx { - class Size; class VSyncProvider; +} + +namespace ui { // The platform-specific part of an software output. The class is intended // for use when no EGL/GLES2 acceleration is possible. // This class owns any bits that the ozone implementation needs freed when // the software output is destroyed. -class GFX_EXPORT SurfaceOzoneCanvas { +class OZONE_BASE_EXPORT SurfaceOzoneCanvas { public: virtual ~SurfaceOzoneCanvas() {} @@ -49,6 +51,6 @@ class GFX_EXPORT SurfaceOzoneCanvas { virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_OZONE_SURFACE_OZONE_CANVAS_H_ +#endif // UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ diff --git a/ui/gfx/ozone/surface_ozone_egl.h b/ui/ozone/public/surface_ozone_egl.h index 97c076e..fa7e43a 100644 --- a/ui/gfx/ozone/surface_ozone_egl.h +++ b/ui/ozone/public/surface_ozone_egl.h @@ -2,23 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_OZONE_SURFACE_OZONE_EGL_H_ -#define UI_GFX_OZONE_SURFACE_OZONE_EGL_H_ +#ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ +#define UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "ui/gfx/gfx_export.h" +#include "ui/ozone/ozone_base_export.h" namespace gfx { - class Size; class VSyncProvider; +} + +namespace ui { // The platform-specific part of an EGL surface. // // This class owns any bits that the ozone implementation needs freed when // the EGL surface is destroyed. -class GFX_EXPORT SurfaceOzoneEGL { +class OZONE_BASE_EXPORT SurfaceOzoneEGL { public: virtual ~SurfaceOzoneEGL() {} @@ -42,6 +44,6 @@ class GFX_EXPORT SurfaceOzoneEGL { virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_OZONE_SURFACE_OZONE_EGL_H_ +#endif // UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_ diff --git a/ui/ui_unittests.gyp b/ui/ui_unittests.gyp index 25bedb9..f510872 100644 --- a/ui/ui_unittests.gyp +++ b/ui/ui_unittests.gyp @@ -202,11 +202,6 @@ 'gfx/screen_unittest.cc', ], }], - ['use_ozone==1', { - 'dependencies': [ - 'gfx/ozone/gfx_ozone.gyp:gfx_ozone', - ], - }], ['use_ozone==1 and use_pango==0', { 'sources!': [ 'gfx/render_text_unittest.cc', |