diff options
46 files changed, 288 insertions, 116 deletions
diff --git a/apps/shell/browser/shell_desktop_controller.cc b/apps/shell/browser/shell_desktop_controller.cc index fec9911..d369b5b 100644 --- a/apps/shell/browser/shell_desktop_controller.cc +++ b/apps/shell/browser/shell_desktop_controller.cc @@ -15,8 +15,8 @@ #include "ui/wm/test/wm_test_helper.h" #if defined(OS_CHROMEOS) -#include "ui/display/chromeos/display_mode.h" -#include "ui/display/chromeos/display_snapshot.h" +#include "ui/display/types/chromeos/display_mode.h" +#include "ui/display/types/chromeos/display_snapshot.h" #endif namespace apps { diff --git a/ash/ash.gyp b/ash/ash.gyp index f97b3e8..a0db4b0 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -1074,6 +1074,7 @@ '../device/bluetooth/bluetooth.gyp:device_bluetooth', '../ui/display/display.gyp:display', '../ui/display/display.gyp:display_test_util', + '../ui/display/display.gyp:display_types', ], 'sources': [ 'first_run/first_run_helper_unittest.cc', diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc index 7105477..4dfc8c4 100644 --- a/ash/display/display_change_observer_chromeos.cc +++ b/ash/display/display_change_observer_chromeos.cc @@ -19,9 +19,9 @@ #include "grit/ash_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/compositor/dip_util.h" -#include "ui/display/chromeos/display_mode.h" -#include "ui/display/chromeos/display_snapshot.h" #include "ui/display/display_util.h" +#include "ui/display/types/chromeos/display_mode.h" +#include "ui/display/types/chromeos/display_snapshot.h" #include "ui/gfx/display.h" namespace ash { diff --git a/ash/display/display_change_observer_chromeos_unittest.cc b/ash/display/display_change_observer_chromeos_unittest.cc index 118e826..aa668e9 100644 --- a/ash/display/display_change_observer_chromeos_unittest.cc +++ b/ash/display/display_change_observer_chromeos_unittest.cc @@ -8,8 +8,8 @@ #include "base/memory/scoped_vector.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/display/chromeos/display_configurator.h" -#include "ui/display/chromeos/display_mode.h" #include "ui/display/chromeos/test/test_display_snapshot.h" +#include "ui/display/types/chromeos/display_mode.h" using ui::DisplayConfigurator; diff --git a/ash/display/display_info.h b/ash/display/display_info.h index fc55466..38e16d8 100644 --- a/ash/display/display_info.h +++ b/ash/display/display_info.h @@ -9,7 +9,7 @@ #include <vector> #include "ash/ash_export.h" -#include "ui/display/display_constants.h" +#include "ui/display/types/display_constants.h" #include "ui/gfx/display.h" #include "ui/gfx/insets.h" #include "ui/gfx/rect.h" diff --git a/ash/display/projecting_observer_chromeos.cc b/ash/display/projecting_observer_chromeos.cc index 404ff24..d13d3ac 100644 --- a/ash/display/projecting_observer_chromeos.cc +++ b/ash/display/projecting_observer_chromeos.cc @@ -6,7 +6,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/power_manager_client.h" -#include "ui/display/chromeos/display_snapshot.h" +#include "ui/display/types/chromeos/display_snapshot.h" namespace ash { diff --git a/ash/test/display_manager_test_api.h b/ash/test/display_manager_test_api.h index 6c5d565..a3c506b1 100644 --- a/ash/test/display_manager_test_api.h +++ b/ash/test/display_manager_test_api.h @@ -9,7 +9,7 @@ #include <vector> #include "base/basictypes.h" -#include "ui/display/display_constants.h" +#include "ui/display/types/display_constants.h" namespace ash { class DisplayManager; diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc index ef48c08..ee686ed 100644 --- a/ash/wm/lock_state_controller_unittest.cc +++ b/ash/wm/lock_state_controller_unittest.cc @@ -28,7 +28,7 @@ #if defined(OS_CHROMEOS) #include "ui/display/chromeos/display_configurator.h" #include "ui/display/chromeos/test/test_display_snapshot.h" -#include "ui/display/display_constants.h" +#include "ui/display/types/display_constants.h" #endif #if defined(OS_WIN) diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc index 3e4861a..f349caf 100644 --- a/ash/wm/power_button_controller.cc +++ b/ash/wm/power_button_controller.cc @@ -12,7 +12,7 @@ #include "ash/wm/session_state_animator.h" #include "base/command_line.h" #include "ui/aura/window_event_dispatcher.h" -#include "ui/display/chromeos/display_snapshot.h" +#include "ui/display/types/chromeos/display_snapshot.h" #include "ui/wm/core/compound_event_filter.h" namespace ash { diff --git a/ui/display/chromeos/display_configurator.cc b/ui/display/chromeos/display_configurator.cc index 8a8885a..1283b58 100644 --- a/ui/display/chromeos/display_configurator.cc +++ b/ui/display/chromeos/display_configurator.cc @@ -11,18 +11,10 @@ #include "base/strings/stringprintf.h" #include "base/sys_info.h" #include "base/time/time.h" -#include "ui/display/chromeos/display_mode.h" -#include "ui/display/chromeos/display_snapshot.h" -#include "ui/display/chromeos/native_display_delegate.h" #include "ui/display/display_switches.h" - -#if defined(USE_OZONE) -#include "ui/display/chromeos/ozone/native_display_delegate_ozone.h" -#include "ui/display/chromeos/ozone/touchscreen_delegate_ozone.h" -#elif defined(USE_X11) -#include "ui/display/chromeos/x11/native_display_delegate_x11.h" -#include "ui/display/chromeos/x11/touchscreen_delegate_x11.h" -#endif +#include "ui/display/types/chromeos/display_mode.h" +#include "ui/display/types/chromeos/display_snapshot.h" +#include "ui/display/types/chromeos/native_display_delegate.h" namespace ui { @@ -172,20 +164,14 @@ DisplayConfigurator::~DisplayConfigurator() { native_display_delegate_->RemoveObserver(this); } -void DisplayConfigurator::SetNativeDisplayDelegateForTesting( - scoped_ptr<NativeDisplayDelegate> delegate) { +void DisplayConfigurator::SetDelegatesForTesting( + scoped_ptr<NativeDisplayDelegate> display_delegate, + scoped_ptr<TouchscreenDelegate> touchscreen_delegate) { DCHECK(!native_display_delegate_); - - native_display_delegate_ = delegate.Pass(); - native_display_delegate_->AddObserver(this); - configure_display_ = true; -} - -void DisplayConfigurator::SetTouchscreenDelegateForTesting( - scoped_ptr<TouchscreenDelegate> delegate) { DCHECK(!touchscreen_delegate_); - touchscreen_delegate_ = delegate.Pass(); + InitializeDelegates(display_delegate.Pass(), touchscreen_delegate.Pass()); + configure_display_ = true; } void DisplayConfigurator::SetInitialDisplayPower( @@ -199,25 +185,17 @@ void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { if (!configure_display_) return; - if (!native_display_delegate_) { -#if defined(USE_OZONE) - native_display_delegate_.reset(new NativeDisplayDelegateOzone()); -#elif defined(USE_X11) - native_display_delegate_.reset(new NativeDisplayDelegateX11()); -#else - NOTREACHED(); -#endif - native_display_delegate_->AddObserver(this); - } + PlatformInitialize(); +} - if (!touchscreen_delegate_) { -#if defined(USE_OZONE) - touchscreen_delegate_.reset(new TouchscreenDelegateOzone()); -#elif defined(USE_X11) - touchscreen_delegate_.reset(new TouchscreenDelegateX11()); -#else - NOTREACHED(); -#endif +void DisplayConfigurator::InitializeDelegates( + scoped_ptr<NativeDisplayDelegate> display_delegate, + scoped_ptr<TouchscreenDelegate> touchscreen_delegate) { + if (!native_display_delegate_ && !touchscreen_delegate_) { + native_display_delegate_ = display_delegate.Pass(); + touchscreen_delegate_ = touchscreen_delegate.Pass(); + + native_display_delegate_->AddObserver(this); } } diff --git a/ui/display/chromeos/display_configurator.h b/ui/display/chromeos/display_configurator.h index 26a423e..028a902 100644 --- a/ui/display/chromeos/display_configurator.h +++ b/ui/display/chromeos/display_configurator.h @@ -16,9 +16,9 @@ #include "base/observer_list.h" #include "base/timer/timer.h" #include "third_party/cros_system_api/dbus/service_constants.h" -#include "ui/display/chromeos/native_display_observer.h" -#include "ui/display/display_constants.h" #include "ui/display/display_export.h" +#include "ui/display/types/chromeos/native_display_observer.h" +#include "ui/display/types/display_constants.h" namespace gfx { class Point; @@ -182,13 +182,12 @@ class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { mirroring_controller_ = controller; } - // Replaces |native_display_delegate_| with |delegate| and sets - // |configure_display_| to true. Should be called before Init(). - void SetNativeDisplayDelegateForTesting( - scoped_ptr<NativeDisplayDelegate> delegate); - - void SetTouchscreenDelegateForTesting( - scoped_ptr<TouchscreenDelegate> delegate); + // Replaces |native_display_delegate_| and |touchscreen_delegate_| with the 2 + // delegates passed in and sets |configure_display_| to true. Should be called + // before Init(). + void SetDelegatesForTesting( + scoped_ptr<NativeDisplayDelegate> display_delegate, + scoped_ptr<TouchscreenDelegate> touchscreen_delegate); // Sets the initial value of |power_state_|. Must be called before Start(). void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); @@ -277,6 +276,15 @@ class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { typedef std::map<ContentProtectionClientId, ContentProtections> ProtectionRequests; + // If |native_display_delegate_| and |touchscreen_delegate_| are not set, then + // set them to the passed in values. + void InitializeDelegates( + scoped_ptr<NativeDisplayDelegate> display_delegate, + scoped_ptr<TouchscreenDelegate> touchscreen_delegate); + + // Performs platform specific delegate initialization. + void PlatformInitialize(); + // Updates |cached_displays_| to contain currently-connected displays. Calls // |delegate_->GetDisplays()| and then does additional work, like finding the // mirror mode and setting user-preferred modes. Note that the server must be diff --git a/ui/display/chromeos/display_configurator_unittest.cc b/ui/display/chromeos/display_configurator_unittest.cc index f7b1182..1790d66 100644 --- a/ui/display/chromeos/display_configurator_unittest.cc +++ b/ui/display/chromeos/display_configurator_unittest.cc @@ -18,9 +18,9 @@ #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/display/chromeos/display_mode.h" -#include "ui/display/chromeos/native_display_delegate.h" #include "ui/display/chromeos/test/test_display_snapshot.h" +#include "ui/display/types/chromeos/display_mode.h" +#include "ui/display/types/chromeos/native_display_delegate.h" namespace ui { @@ -399,11 +399,9 @@ class DisplayConfiguratorTest : public testing::Test { log_.reset(new ActionLogger()); native_display_delegate_ = new TestNativeDisplayDelegate(log_.get()); - configurator_.SetNativeDisplayDelegateForTesting( - scoped_ptr<NativeDisplayDelegate>(native_display_delegate_)); - touchscreen_delegate_ = new TestTouchscreenDelegate(log_.get()); - configurator_.SetTouchscreenDelegateForTesting( + configurator_.SetDelegatesForTesting( + scoped_ptr<NativeDisplayDelegate>(native_display_delegate_), scoped_ptr<DisplayConfigurator::TouchscreenDelegate>( touchscreen_delegate_)); diff --git a/ui/display/chromeos/ozone/DEPS b/ui/display/chromeos/ozone/DEPS new file mode 100644 index 0000000..7d4f8a1 --- /dev/null +++ b/ui/display/chromeos/ozone/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+ui/ozone", +] diff --git a/ui/display/chromeos/ozone/display_configurator_ozone.cc b/ui/display/chromeos/ozone/display_configurator_ozone.cc new file mode 100644 index 0000000..48f0792d --- /dev/null +++ b/ui/display/chromeos/ozone/display_configurator_ozone.cc @@ -0,0 +1,19 @@ +// 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/display/chromeos/display_configurator.h" + +#include "ui/display/chromeos/ozone/touchscreen_delegate_ozone.h" +#include "ui/display/types/chromeos/native_display_delegate.h" +#include "ui/ozone/ozone_platform.h" + +namespace ui { + +void DisplayConfigurator::PlatformInitialize() { + InitializeDelegates( + ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), + scoped_ptr<TouchscreenDelegate>(new TouchscreenDelegateOzone())); +} + +} // namespace ui diff --git a/ui/display/chromeos/test/test_display_snapshot.h b/ui/display/chromeos/test/test_display_snapshot.h index cac7938..3563b33 100644 --- a/ui/display/chromeos/test/test_display_snapshot.h +++ b/ui/display/chromeos/test/test_display_snapshot.h @@ -5,7 +5,8 @@ #ifndef UI_DISPLAY_CHROMEOS_TEST_TEST_DISPLAY_SNAPSHOT_H_ #define UI_DISPLAY_CHROMEOS_TEST_TEST_DISPLAY_SNAPSHOT_H_ -#include "ui/display/chromeos/display_snapshot.h" +#include "ui/display/display_export.h" +#include "ui/display/types/chromeos/display_snapshot.h" namespace ui { diff --git a/ui/display/chromeos/x11/display_configurator_x11.cc b/ui/display/chromeos/x11/display_configurator_x11.cc new file mode 100644 index 0000000..a21219a --- /dev/null +++ b/ui/display/chromeos/x11/display_configurator_x11.cc @@ -0,0 +1,19 @@ +// 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/display/chromeos/display_configurator.h" + +#include "ui/display/chromeos/x11/native_display_delegate_x11.h" +#include "ui/display/chromeos/x11/touchscreen_delegate_x11.h" + + +namespace ui { + +void DisplayConfigurator::PlatformInitialize() { + InitializeDelegates( + scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateX11()), + scoped_ptr<TouchscreenDelegate>(new TouchscreenDelegateX11())); +} + +} // namespace ui diff --git a/ui/display/chromeos/x11/display_mode_x11.h b/ui/display/chromeos/x11/display_mode_x11.h index fa6739d..21cf6fb 100644 --- a/ui/display/chromeos/x11/display_mode_x11.h +++ b/ui/display/chromeos/x11/display_mode_x11.h @@ -5,7 +5,8 @@ #ifndef UI_DISPLAY_CHROMEOS_X11_DISPLAY_MODE_X11_H_ #define UI_DISPLAY_CHROMEOS_X11_DISPLAY_MODE_X11_H_ -#include "ui/display/chromeos/display_mode.h" +#include "ui/display/display_export.h" +#include "ui/display/types/chromeos/display_mode.h" // Forward declare from Xlib and Xrandr. typedef unsigned long XID; diff --git a/ui/display/chromeos/x11/display_snapshot_x11.h b/ui/display/chromeos/x11/display_snapshot_x11.h index 1f55d14..fb62ddb 100644 --- a/ui/display/chromeos/x11/display_snapshot_x11.h +++ b/ui/display/chromeos/x11/display_snapshot_x11.h @@ -5,7 +5,8 @@ #ifndef UI_DISPLAY_CHROMEOS_X11_DISPLAY_SNAPSHOT_X11_H_ #define UI_DISPLAY_CHROMEOS_X11_DISPLAY_SNAPSHOT_X11_H_ -#include "ui/display/chromeos/display_snapshot.h" +#include "ui/display/display_export.h" +#include "ui/display/types/chromeos/display_snapshot.h" // Forward declare from Xlib and Xrandr. typedef unsigned long XID; diff --git a/ui/display/chromeos/x11/display_util_x11.h b/ui/display/chromeos/x11/display_util_x11.h index 894d855..1bc2369 100644 --- a/ui/display/chromeos/x11/display_util_x11.h +++ b/ui/display/chromeos/x11/display_util_x11.h @@ -7,8 +7,8 @@ #include <string> -#include "ui/display/display_constants.h" #include "ui/display/display_export.h" +#include "ui/display/types/display_constants.h" typedef unsigned long XID; typedef XID RROutput; diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.cc b/ui/display/chromeos/x11/native_display_delegate_x11.cc index 39b7e4c..2258fa3 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.cc +++ b/ui/display/chromeos/x11/native_display_delegate_x11.cc @@ -14,11 +14,11 @@ #include "base/logging.h" #include "base/stl_util.h" -#include "ui/display/chromeos/native_display_observer.h" #include "ui/display/chromeos/x11/display_mode_x11.h" #include "ui/display/chromeos/x11/display_snapshot_x11.h" #include "ui/display/chromeos/x11/display_util_x11.h" #include "ui/display/chromeos/x11/native_display_event_dispatcher_x11.h" +#include "ui/display/types/chromeos/native_display_observer.h" #include "ui/display/x11/edid_parser_x11.h" #include "ui/events/platform/platform_event_observer.h" #include "ui/events/platform/platform_event_source.h" diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.h b/ui/display/chromeos/x11/native_display_delegate_x11.h index be2f308..5112197 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.h +++ b/ui/display/chromeos/x11/native_display_delegate_x11.h @@ -15,7 +15,8 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/observer_list.h" -#include "ui/display/chromeos/native_display_delegate.h" +#include "ui/display/display_export.h" +#include "ui/display/types/chromeos/native_display_delegate.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/size.h" diff --git a/ui/display/chromeos/x11/touchscreen_delegate_x11.cc b/ui/display/chromeos/x11/touchscreen_delegate_x11.cc index 4a72c69..3b69d3a 100644 --- a/ui/display/chromeos/x11/touchscreen_delegate_x11.cc +++ b/ui/display/chromeos/x11/touchscreen_delegate_x11.cc @@ -10,8 +10,8 @@ #include <cmath> #include <set> -#include "ui/display/chromeos/display_mode.h" -#include "ui/display/chromeos/display_snapshot.h" +#include "ui/display/types/chromeos/display_mode.h" +#include "ui/display/types/chromeos/display_snapshot.h" #include "ui/gfx/x/x11_types.h" namespace ui { diff --git a/ui/display/display.gyp b/ui/display/display.gyp index 5ff64a9..3cc5d8e 100644 --- a/ui/display/display.gyp +++ b/ui/display/display.gyp @@ -8,6 +8,27 @@ }, 'targets': [ { + 'target_name': 'display_types', + 'type': '<(component)', + 'dependencies': [ + '../../base/base.gyp:base', + '../../ui/gfx/gfx.gyp:gfx_geometry', + ], + 'defines': [ + 'DISPLAY_TYPES_IMPLEMENTATION', + ], + 'sources': [ + 'types/chromeos/display_mode.cc', + 'types/chromeos/display_mode.h', + 'types/chromeos/display_snapshot.cc', + 'types/chromeos/display_snapshot.h', + 'types/chromeos/native_display_delegate.h', + 'types/chromeos/native_display_observer', + 'types/display_constants.h', + 'types/display_types_export.h', + ], + }, + { 'target_name': 'display', 'type': '<(component)', 'dependencies': [ @@ -21,16 +42,10 @@ 'sources': [ 'chromeos/display_configurator.cc', 'chromeos/display_configurator.h', - 'chromeos/display_mode.cc', - 'chromeos/display_mode.h', - 'chromeos/display_snapshot.cc', - 'chromeos/display_snapshot.h', - 'chromeos/native_display_delegate.h', - 'chromeos/native_display_observer.h', - 'chromeos/ozone/native_display_delegate_ozone.cc', - 'chromeos/ozone/native_display_delegate_ozone.h', + 'chromeos/ozone/display_configurator_ozone.cc', 'chromeos/ozone/touchscreen_delegate_ozone.cc', 'chromeos/ozone/touchscreen_delegate_ozone.h', + 'chromeos/x11/display_configurator_x11.cc', 'chromeos/x11/display_mode_x11.cc', 'chromeos/x11/display_mode_x11.h', 'chromeos/x11/display_snapshot_x11.cc', @@ -43,7 +58,6 @@ 'chromeos/x11/native_display_event_dispatcher_x11.h', 'chromeos/x11/touchscreen_delegate_x11.cc', 'chromeos/x11/touchscreen_delegate_x11.h', - 'display_constants.h', 'display_export.h', 'display_switches.cc', 'display_switches.h', @@ -63,6 +77,11 @@ '../../build/linux/system.gyp:xrandr', ], }], + ['chromeos == 1', { + 'dependencies': [ + 'display_types', + ], + }], ], }, { @@ -72,7 +91,6 @@ '../../base/base.gyp:base', '../../ui/gfx/gfx.gyp:gfx', '../../ui/gfx/gfx.gyp:gfx_geometry', - 'display', ], 'defines': [ 'DISPLAY_IMPLEMENTATION', @@ -81,6 +99,13 @@ 'chromeos/test/test_display_snapshot.cc', 'chromeos/test/test_display_snapshot.h', ], + 'conditions': [ + ['chromeos == 1', { + 'dependencies': [ + 'display_types', + ], + }], + ], }, ], } diff --git a/ui/display/display_unittests.gypi b/ui/display/display_unittests.gypi index 5fa9303..75f5c77 100644 --- a/ui/display/display_unittests.gypi +++ b/ui/display/display_unittests.gypi @@ -25,6 +25,7 @@ ['chromeos == 1', { 'dependencies': [ '../ui/display/display.gyp:display_test_util', + '../ui/display/display.gyp:display_types', ], }], ], diff --git a/ui/display/types/DEPS b/ui/display/types/DEPS new file mode 100644 index 0000000..f2fc77d --- /dev/null +++ b/ui/display/types/DEPS @@ -0,0 +1,5 @@ +include_rules = [ + "-ui", + "+ui/display/types", + "+ui/gfx/geometry", +] diff --git a/ui/display/chromeos/display_mode.cc b/ui/display/types/chromeos/display_mode.cc index f4f3064..b0d5e56 100644 --- a/ui/display/chromeos/display_mode.cc +++ b/ui/display/types/chromeos/display_mode.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/display/chromeos/display_mode.h" +#include "ui/display/types/chromeos/display_mode.h" #include "base/strings/stringprintf.h" diff --git a/ui/display/chromeos/display_mode.h b/ui/display/types/chromeos/display_mode.h index cf3d540..092a43a 100644 --- a/ui/display/chromeos/display_mode.h +++ b/ui/display/types/chromeos/display_mode.h @@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_DISPLAY_CHROMEOS_DISPLAY_MODE_H_ -#define UI_DISPLAY_CHROMEOS_DISPLAY_MODE_H_ +#ifndef UI_DISPLAY_TYPES_CHROMEOS_DISPLAY_MODE_H_ +#define UI_DISPLAY_TYPES_CHROMEOS_DISPLAY_MODE_H_ #include <string> #include "base/macros.h" -#include "ui/display/display_export.h" +#include "ui/display/types/display_types_export.h" #include "ui/gfx/geometry/size.h" namespace ui { // This class represents the basic information for a native mode. Platforms will // extend this class to add platform specific information about the mode. -class DISPLAY_EXPORT DisplayMode { +class DISPLAY_TYPES_EXPORT DisplayMode { public: DisplayMode(const gfx::Size& size, bool interlaced, float refresh_rate); virtual ~DisplayMode(); @@ -36,4 +36,4 @@ class DISPLAY_EXPORT DisplayMode { } // namespace ui -#endif // UI_DISPLAY_CHROMEOS_DISPLAY_MODE_H_ +#endif // UI_DISPLAY_TYPES_CHROMEOS_DISPLAY_MODE_H_ diff --git a/ui/display/chromeos/display_snapshot.cc b/ui/display/types/chromeos/display_snapshot.cc index da2827a..e90fdda 100644 --- a/ui/display/chromeos/display_snapshot.cc +++ b/ui/display/types/chromeos/display_snapshot.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/display/chromeos/display_snapshot.h" +#include "ui/display/types/chromeos/display_snapshot.h" namespace ui { diff --git a/ui/display/chromeos/display_snapshot.h b/ui/display/types/chromeos/display_snapshot.h index 68d73e8..1dc0573 100644 --- a/ui/display/chromeos/display_snapshot.h +++ b/ui/display/types/chromeos/display_snapshot.h @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_DISPLAY_CHROMEOS_DISPLAY_SNAPSHOT_H_ -#define UI_DISPLAY_CHROMEOS_DISPLAY_SNAPSHOT_H_ +#ifndef UI_DISPLAY_TYPES_CHROMEOS_DISPLAY_SNAPSHOT_H_ +#define UI_DISPLAY_TYPES_CHROMEOS_DISPLAY_SNAPSHOT_H_ #include <vector> -#include "ui/display/chromeos/display_mode.h" -#include "ui/display/chromeos/display_snapshot.h" -#include "ui/display/display_constants.h" +#include "ui/display/types/chromeos/display_mode.h" +#include "ui/display/types/display_constants.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/size.h" @@ -18,7 +17,7 @@ namespace ui { // This class represents the state of a display at one point in time. Platforms // will extend this class in order to add platform specific configuration and // identifiers required to configure this display. -class DISPLAY_EXPORT DisplaySnapshot { +class DISPLAY_TYPES_EXPORT DisplaySnapshot { public: DisplaySnapshot(int64_t display_id, bool has_proper_display_id, @@ -88,4 +87,4 @@ class DISPLAY_EXPORT DisplaySnapshot { } // namespace ui -#endif // UI_DISPLAY_CHROMEOS_DISPLAY_SNAPSHOT_H_ +#endif // UI_DISPLAY_TYPES_CHROMEOS_DISPLAY_SNAPSHOT_H_ diff --git a/ui/display/chromeos/native_display_delegate.h b/ui/display/types/chromeos/native_display_delegate.h index 5532607..8cbffdb 100644 --- a/ui/display/chromeos/native_display_delegate.h +++ b/ui/display/types/chromeos/native_display_delegate.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_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ -#define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ +#ifndef UI_DISPLAY_TYPES_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ +#define UI_DISPLAY_TYPES_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ #include <stdint.h> #include <vector> -#include "ui/display/display_constants.h" -#include "ui/display/display_export.h" +#include "ui/display/types/display_constants.h" +#include "ui/display/types/display_types_export.h" namespace gfx { class Point; @@ -25,7 +25,7 @@ class NativeDisplayObserver; // Interface for classes that perform display configuration actions on behalf // of DisplayConfigurator. -class DISPLAY_EXPORT NativeDisplayDelegate { +class DISPLAY_TYPES_EXPORT NativeDisplayDelegate { public: virtual ~NativeDisplayDelegate() {} @@ -92,4 +92,4 @@ class DISPLAY_EXPORT NativeDisplayDelegate { } // namespace ui -#endif // UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ +#endif // UI_DISPLAY_TYPES_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ diff --git a/ui/display/chromeos/native_display_observer.h b/ui/display/types/chromeos/native_display_observer.h index 189aa99..1b3d0ba 100644 --- a/ui/display/chromeos/native_display_observer.h +++ b/ui/display/types/chromeos/native_display_observer.h @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_OBSERVER_H_ -#define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_OBSERVER_H_ +#ifndef UI_DISPLAY_TYPES_CHROMEOS_NATIVE_DISPLAY_OBSERVER_H_ +#define UI_DISPLAY_TYPES_CHROMEOS_NATIVE_DISPLAY_OBSERVER_H_ + +#include "ui/display/types/display_types_export.h" namespace ui { // Observer class used by NativeDisplayDelegate to announce when the display // configuration changes. -class NativeDisplayObserver { +class DISPLAY_TYPES_EXPORT NativeDisplayObserver { public: virtual ~NativeDisplayObserver() {} @@ -18,4 +20,4 @@ class NativeDisplayObserver { } // namespace ui -#endif // UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_OBSERVER_H_ +#endif // UI_DISPLAY_TYPES_CHROMEOS_NATIVE_DISPLAY_OBSERVER_H_ diff --git a/ui/display/display_constants.h b/ui/display/types/display_constants.h index b721fc7..cf4ee60 100644 --- a/ui/display/display_constants.h +++ b/ui/display/types/display_constants.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_DISPLAY_DISPLAY_CONSTANTS_H_ -#define UI_DISPLAY_DISPLAY_CONSTANTS_H_ +#ifndef UI_DISPLAY_TYPES_DISPLAY_CONSTANTS_H_ +#define UI_DISPLAY_TYPES_DISPLAY_CONSTANTS_H_ namespace ui { @@ -49,4 +49,4 @@ enum ColorCalibrationProfile { } // namespace ui -#endif // UI_DISPLAY_DISPLAY_CONSTANTS_H_ +#endif // UI_DISPLAY_TYPES_DISPLAY_CONSTANTS_H_ diff --git a/ui/display/types/display_types_export.h b/ui/display/types/display_types_export.h new file mode 100644 index 0000000..b2ddbd1 --- /dev/null +++ b/ui/display/types/display_types_export.h @@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_DISPLAY_DISPLAY_TYPES_EXPORT_H_ +#define UI_DISPLAY_DISPLAY_TYPES_EXPORT_H_ + +// Defines DISPLAY_TYPES_EXPORT so that functionality implemented by the +// DISPLAY_TYPES module can be exported to consumers. + +#if defined(COMPONENT_BUILD) + +#if defined(WIN32) + +#if defined(DISPLAY_TYPES_IMPLEMENTATION) +#define DISPLAY_TYPES_EXPORT __declspec(dllexport) +#else +#define DISPLAY_TYPES_EXPORT __declspec(dllimport) +#endif + +#else // !defined(WIN32) + +#if defined(DISPLAY_TYPES_IMPLEMENTATION) +#define DISPLAY_TYPES_EXPORT __attribute__((visibility("default"))) +#else +#define DISPLAY_TYPES_EXPORT +#endif + +#endif + +#else // !defined(COMPONENT_BUILD) + +#define DISPLAY_TYPES_EXPORT + +#endif + +#endif // UI_DISPLAY_DISPLAY_TYPES_EXPORT_H_ diff --git a/ui/display/x11/edid_parser_x11.h b/ui/display/x11/edid_parser_x11.h index 951dd2f..d6ac9b9 100644 --- a/ui/display/x11/edid_parser_x11.h +++ b/ui/display/x11/edid_parser_x11.h @@ -9,8 +9,8 @@ #include <string> -#include "ui/display/display_constants.h" #include "ui/display/display_export.h" +#include "ui/display/types/display_constants.h" typedef unsigned long XID; typedef XID RROutput; diff --git a/ui/ozone/DEPS b/ui/ozone/DEPS index 1c20697..7346019 100644 --- a/ui/ozone/DEPS +++ b/ui/ozone/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+ui/display/types", "+ui/events", "+ui/gfx", "+ui/base/cursor", diff --git a/ui/display/chromeos/ozone/native_display_delegate_ozone.cc b/ui/ozone/common/chromeos/native_display_delegate_ozone.cc index 8f5517f..2efc18d 100644 --- a/ui/display/chromeos/ozone/native_display_delegate_ozone.cc +++ b/ui/ozone/common/chromeos/native_display_delegate_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/display/chromeos/ozone/native_display_delegate_ozone.h" +#include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" #include "base/logging.h" diff --git a/ui/display/chromeos/ozone/native_display_delegate_ozone.h b/ui/ozone/common/chromeos/native_display_delegate_ozone.h index cb01171..cb61bd7 100644 --- a/ui/display/chromeos/ozone/native_display_delegate_ozone.h +++ b/ui/ozone/common/chromeos/native_display_delegate_ozone.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_DISPLAY_CHROMEOS_OZONE_NATIVE_DISPLAY_DELEGATE_OZONE_H_ -#define UI_DISPLAY_CHROMEOS_OZONE_NATIVE_DISPLAY_DELEGATE_OZONE_H_ +#ifndef UI_OZONE_COMMON_CHROMEOS_NATIVE_DISPLAY_DELEGATE_OZONE_H_ +#define UI_OZONE_COMMON_CHROMEOS_NATIVE_DISPLAY_DELEGATE_OZONE_H_ #include "base/macros.h" -#include "ui/display/chromeos/native_display_delegate.h" +#include "ui/display/types/chromeos/native_display_delegate.h" namespace ui { @@ -48,4 +48,4 @@ class NativeDisplayDelegateOzone : public NativeDisplayDelegate { } // namespace ui -#endif // UI_DISPLAY_CHROMEOS_OZONE_NATIVE_DISPLAY_DELEGATE_OZONE_H_ +#endif // UI_OZONE_COMMON_CHROMEOS_NATIVE_DISPLAY_DELEGATE_OZONE_H_ diff --git a/ui/ozone/ozone.gyp b/ui/ozone/ozone.gyp index 99de5b4..0dfb9c7 100644 --- a/ui/ozone/ozone.gyp +++ b/ui/ozone/ozone.gyp @@ -32,6 +32,11 @@ }, 'sources': [ '<(platform_list_file)', + # common/chromeos files are excluded automatically when building with + # chromeos=0, by exclusion rules in filename_rules.gypi due to the + # 'chromeos' folder name. + 'common/chromeos/native_display_delegate_ozone.cc', + 'common/chromeos/native_display_delegate_ozone.h', 'ozone_platform.cc', 'ozone_platform.h', 'ozone_switches.cc', @@ -92,6 +97,11 @@ ['exclude', '^platform/test/'], ] }], + ['chromeos==1', { + 'dependencies': [ + '<(DEPTH)/ui/display/display.gyp:display_types', + ], + }], ] }, ], diff --git a/ui/ozone/ozone_platform.cc b/ui/ozone/ozone_platform.cc index 53016cd..feb36ba 100644 --- a/ui/ozone/ozone_platform.cc +++ b/ui/ozone/ozone_platform.cc @@ -65,6 +65,12 @@ void OzonePlatform::Initialize() { } // static +OzonePlatform* OzonePlatform::GetInstance() { + CHECK(instance_) << "OzonePlatform is not initialized"; + return instance_; +} + +// static OzonePlatform* OzonePlatform::instance_; } // namespace ui diff --git a/ui/ozone/ozone_platform.h b/ui/ozone/ozone_platform.h index 61cd9ef..e87f422 100644 --- a/ui/ozone/ozone_platform.h +++ b/ui/ozone/ozone_platform.h @@ -14,6 +14,7 @@ namespace ui { class CursorFactoryOzone; +class NativeDisplayDelegate; // Base class for Ozone platform implementations. // @@ -38,6 +39,8 @@ class OZONE_EXPORT OzonePlatform { // EventFactoryOzone will be set. static void Initialize(); + static OzonePlatform* GetInstance(); + // 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. @@ -46,6 +49,10 @@ class OZONE_EXPORT OzonePlatform { virtual ui::InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone() = 0; virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; +#if defined(OS_CHROMEOS) + virtual scoped_ptr<ui::NativeDisplayDelegate> + CreateNativeDisplayDelegate() = 0; +#endif private: static OzonePlatform* instance_; diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/caca/ozone_platform_caca.cc index dfe67ac..6a35c6b 100644 --- a/ui/ozone/platform/caca/ozone_platform_caca.cc +++ b/ui/ozone/platform/caca/ozone_platform_caca.cc @@ -7,6 +7,10 @@ #include "ui/ozone/ozone_platform.h" #include "ui/ozone/platform/caca/caca_connection.h" +#if defined(OS_CHROMEOS) +#include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" +#endif + namespace ui { OzonePlatformCaca::OzonePlatformCaca() @@ -33,6 +37,14 @@ ui::CursorFactoryOzone* OzonePlatformCaca::GetCursorFactoryOzone() { return &cursor_factory_ozone_; } +#if defined(OS_CHROMEOS) +scoped_ptr<ui::NativeDisplayDelegate> +OzonePlatformCaca::CreateNativeDisplayDelegate() { + return scoped_ptr<ui::NativeDisplayDelegate>( + new NativeDisplayDelegateOzone()); +} +#endif + OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } } // namespace ui diff --git a/ui/ozone/platform/caca/ozone_platform_caca.h b/ui/ozone/platform/caca/ozone_platform_caca.h index fd14c5e..f25b947 100644 --- a/ui/ozone/platform/caca/ozone_platform_caca.h +++ b/ui/ozone/platform/caca/ozone_platform_caca.h @@ -26,6 +26,10 @@ class OzonePlatformCaca : public OzonePlatform { virtual ui::InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone() OVERRIDE; virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE; +#if defined(OS_CHROMEOS) + virtual scoped_ptr<ui::NativeDisplayDelegate> + CreateNativeDisplayDelegate() OVERRIDE; +#endif private: ui::CacaConnection connection_; diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc index ce5587b..8175a1d 100644 --- a/ui/ozone/platform/dri/ozone_platform_dri.cc +++ b/ui/ozone/platform/dri/ozone_platform_dri.cc @@ -7,6 +7,10 @@ #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" #include "ui/ozone/ozone_platform.h" +#if defined(OS_CHROMEOS) +#include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" +#endif + namespace ui { OzonePlatformDri::OzonePlatformDri() @@ -32,6 +36,14 @@ ui::CursorFactoryOzone* OzonePlatformDri::GetCursorFactoryOzone() { return &cursor_factory_ozone_; } +#if defined(OS_CHROMEOS) +scoped_ptr<ui::NativeDisplayDelegate> +OzonePlatformDri::CreateNativeDisplayDelegate() { + return scoped_ptr<ui::NativeDisplayDelegate>( + new NativeDisplayDelegateOzone()); +} +#endif + OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } } // namespace ui diff --git a/ui/ozone/platform/dri/ozone_platform_dri.h b/ui/ozone/platform/dri/ozone_platform_dri.h index 0ee8650..dff706b 100644 --- a/ui/ozone/platform/dri/ozone_platform_dri.h +++ b/ui/ozone/platform/dri/ozone_platform_dri.h @@ -26,6 +26,10 @@ class OzonePlatformDri : public OzonePlatform { virtual ui::InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone() OVERRIDE; virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE; +#if defined(OS_CHROMEOS) + virtual scoped_ptr<ui::NativeDisplayDelegate> + CreateNativeDisplayDelegate() OVERRIDE; +#endif private: gfx::DriSurfaceFactory surface_factory_ozone_; diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/test/ozone_platform_test.cc index 6428c79..2a84895 100644 --- a/ui/ozone/platform/test/ozone_platform_test.cc +++ b/ui/ozone/platform/test/ozone_platform_test.cc @@ -9,6 +9,10 @@ #include "ui/ozone/ozone_platform.h" #include "ui/ozone/ozone_switches.h" +#if defined(OS_CHROMEOS) +#include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" +#endif + namespace ui { OzonePlatformTest::OzonePlatformTest(const base::FilePath& dump_file) @@ -33,6 +37,15 @@ ui::CursorFactoryOzone* OzonePlatformTest::GetCursorFactoryOzone() { return &cursor_factory_ozone_; } +#if defined(OS_CHROMEOS) +scoped_ptr<ui::NativeDisplayDelegate> +OzonePlatformTest::CreateNativeDisplayDelegate() { + return scoped_ptr<ui::NativeDisplayDelegate>( + new NativeDisplayDelegateOzone()); + return scoped_ptr<ui::NativeDisplayDelegate>(); +} +#endif + OzonePlatform* CreateOzonePlatformTest() { CommandLine* cmd = CommandLine::ForCurrentProcess(); base::FilePath location = base::FilePath("/dev/null"); diff --git a/ui/ozone/platform/test/ozone_platform_test.h b/ui/ozone/platform/test/ozone_platform_test.h index 633490d..1f6a964 100644 --- a/ui/ozone/platform/test/ozone_platform_test.h +++ b/ui/ozone/platform/test/ozone_platform_test.h @@ -26,6 +26,10 @@ class OzonePlatformTest : public OzonePlatform { virtual ui::InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone() OVERRIDE; virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE; +#if defined(OS_CHROMEOS) + virtual scoped_ptr<ui::NativeDisplayDelegate> + CreateNativeDisplayDelegate() OVERRIDE; +#endif private: gfx::FileSurfaceFactory surface_factory_ozone_; |