diff options
-rw-r--r-- | ash/shelf/shelf_util.cc | 1 | ||||
-rw-r--r-- | ash/touch/touch_uma.cc | 2 | ||||
-rw-r--r-- | ash/wm/system_modal_container_layout_manager.cc | 2 | ||||
-rw-r--r-- | ash/wm/window_properties.cc | 2 | ||||
-rw-r--r-- | athena/extensions/athena_constrained_window_views_client.cc | 2 | ||||
-rw-r--r-- | athena/screen/modal_window_controller.cc | 2 | ||||
-rw-r--r-- | athena/screen/screen_manager_impl.cc | 3 | ||||
-rw-r--r-- | athena/util/fill_layout_manager.cc | 3 | ||||
-rw-r--r-- | athena/wm/window_list_provider_impl.cc | 2 | ||||
-rw-r--r-- | ui/aura/client/aura_constants.cc | 2 | ||||
-rw-r--r-- | ui/aura/client/focus_client.cc | 1 | ||||
-rw-r--r-- | ui/aura/window.h | 6 | ||||
-rw-r--r-- | ui/aura/window_property.h | 88 | ||||
-rw-r--r-- | ui/aura/window_unittest.cc | 45 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc | 2 | ||||
-rw-r--r-- | ui/wm/core/transient_window_manager.cc | 2 | ||||
-rw-r--r-- | ui/wm/core/window_animations.cc | 2 |
18 files changed, 76 insertions, 93 deletions
diff --git a/ash/shelf/shelf_util.cc b/ash/shelf/shelf_util.cc index 70fa02b..f5e2658 100644 --- a/ash/shelf/shelf_util.cc +++ b/ash/shelf/shelf_util.cc @@ -7,6 +7,7 @@ #include "ash/shelf/shelf_constants.h" #include "ui/aura/window_property.h" +DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfID); DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*); namespace ash { diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc index de0f399..04948d2 100644 --- a/ash/touch/touch_uma.cc +++ b/ash/touch/touch_uma.cc @@ -46,8 +46,6 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(WindowTouchDetails, NULL); } -DECLARE_WINDOW_PROPERTY_TYPE(WindowTouchDetails*); - namespace ash { // static diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc index 9268458..85916d8 100644 --- a/ash/wm/system_modal_container_layout_manager.cc +++ b/ash/wm/system_modal_container_layout_manager.cc @@ -30,6 +30,8 @@ #include "ui/views/widget/widget.h" #include "ui/wm/core/compound_event_filter.h" +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ASH_EXPORT, bool); + namespace ash { // If this is set to true, the window will get centered. diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc index f7c8b56..d071a5f 100644 --- a/ash/wm/window_properties.cc +++ b/ash/wm/window_properties.cc @@ -8,6 +8,8 @@ #include "ui/aura/window_property.h" DECLARE_WINDOW_PROPERTY_TYPE(ash::wm::WindowState*); +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ASH_EXPORT, gfx::Rect*) +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ASH_EXPORT, ui::WindowShowState) namespace ash { diff --git a/athena/extensions/athena_constrained_window_views_client.cc b/athena/extensions/athena_constrained_window_views_client.cc index 7a89d53..1645639 100644 --- a/athena/extensions/athena_constrained_window_views_client.cc +++ b/athena/extensions/athena_constrained_window_views_client.cc @@ -16,8 +16,6 @@ #include "ui/aura/window_observer.h" #include "ui/aura/window_property.h" -DECLARE_WINDOW_PROPERTY_TYPE(web_modal::ModalDialogHost*); - namespace athena { namespace { diff --git a/athena/screen/modal_window_controller.cc b/athena/screen/modal_window_controller.cc index 63d82b6..140b2c9 100644 --- a/athena/screen/modal_window_controller.cc +++ b/athena/screen/modal_window_controller.cc @@ -13,8 +13,6 @@ #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/wm/core/window_animations.h" -DECLARE_WINDOW_PROPERTY_TYPE(athena::ModalWindowController*); - namespace athena { namespace { diff --git a/athena/screen/screen_manager_impl.cc b/athena/screen/screen_manager_impl.cc index dee725b..8f960eb 100644 --- a/athena/screen/screen_manager_impl.cc +++ b/athena/screen/screen_manager_impl.cc @@ -25,7 +25,8 @@ #include "ui/wm/core/focus_controller.h" #include "ui/wm/core/window_util.h" -DECLARE_WINDOW_PROPERTY_TYPE(athena::ScreenManager::ContainerParams*); +// This is to avoid creating type definitoin for kAlwaysOnTopKey. +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool); namespace athena { namespace { diff --git a/athena/util/fill_layout_manager.cc b/athena/util/fill_layout_manager.cc index 2fe7722..2a3eb22 100644 --- a/athena/util/fill_layout_manager.cc +++ b/athena/util/fill_layout_manager.cc @@ -8,6 +8,9 @@ #include "ui/aura/window.h" #include "ui/aura/window_property.h" +// This is to avoid creating type definitoin for kAlwaysFillWindowKey. +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool); + namespace athena { namespace { diff --git a/athena/wm/window_list_provider_impl.cc b/athena/wm/window_list_provider_impl.cc index eec4f8b..6823a4d 100644 --- a/athena/wm/window_list_provider_impl.cc +++ b/athena/wm/window_list_provider_impl.cc @@ -13,6 +13,8 @@ #include "ui/wm/core/transient_window_manager.h" #include "ui/wm/core/window_util.h" +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool); + namespace athena { namespace { diff --git a/ui/aura/client/aura_constants.cc b/ui/aura/client/aura_constants.cc index b54ee7e0..f903bff 100644 --- a/ui/aura/client/aura_constants.cc +++ b/ui/aura/client/aura_constants.cc @@ -12,8 +12,6 @@ DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, ui::ModalType) DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, gfx::Rect*) DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, ui::InputMethod*) DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, ui::WindowShowState) -DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, int) -DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, void*) namespace aura { namespace client { diff --git a/ui/aura/client/focus_client.cc b/ui/aura/client/focus_client.cc index 0f69c5e..1f24a80 100644 --- a/ui/aura/client/focus_client.cc +++ b/ui/aura/client/focus_client.cc @@ -7,6 +7,7 @@ #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_property.h" +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, aura::Window*) DECLARE_WINDOW_PROPERTY_TYPE(aura::client::FocusClient*) namespace aura { diff --git a/ui/aura/window.h b/ui/aura/window.h index 79b8467..d1cff7b 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -52,10 +52,6 @@ class WindowTreeHost; template<typename T> struct WindowProperty; -namespace subtle { -class PropertyHelper; -} - namespace test { class WindowTestApi; } @@ -336,7 +332,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate, friend class test::WindowTestApi; friend class LayoutManager; friend class WindowTargeter; - friend class subtle::PropertyHelper; + // Called by the public {Set,Get,Clear}Property functions. int64 SetPropertyInternal(const void* key, const char* name, diff --git a/ui/aura/window_property.h b/ui/aura/window_property.h index 23769d3..0b1574e 100644 --- a/ui/aura/window_property.h +++ b/ui/aura/window_property.h @@ -9,7 +9,8 @@ #include "ui/aura/aura_export.h" #include "ui/aura/window.h" -// This header should be included by code that defines WindowProperties. +// This header should be included by code that defines WindowProperties. It +// should not be included by code that only gets and sets WindowProperties. // // To define a new WindowProperty: // @@ -77,69 +78,56 @@ struct WindowProperty { Window::PropertyDeallocator deallocator; }; -namespace subtle { - -class AURA_EXPORT PropertyHelper { - public: - template<typename T> - static void Set(Window* window, const WindowProperty<T>* property, T value) { - int64 old = window->SetPropertyInternal( - property, - property->name, - value == property->default_value ? nullptr : property->deallocator, - WindowPropertyCaster<T>::ToInt64(value), - WindowPropertyCaster<T>::ToInt64(property->default_value)); - if (property->deallocator && - old != WindowPropertyCaster<T>::ToInt64(property->default_value)) { - (*property->deallocator)(old); - } - } - template<typename T> - static T Get(const Window* window, const WindowProperty<T>* property) { - return WindowPropertyCaster<T>::FromInt64(window->GetPropertyInternal( - property, WindowPropertyCaster<T>::ToInt64(property->default_value))); - } - template<typename T> - static void Clear(Window* window, const WindowProperty<T>* property) { - window->SetProperty(property, property->default_value); \ +template<typename T> +void Window::SetProperty(const WindowProperty<T>* property, T value) { + int64 old = SetPropertyInternal( + property, + property->name, + value == property->default_value ? NULL : property->deallocator, + WindowPropertyCaster<T>::ToInt64(value), + WindowPropertyCaster<T>::ToInt64(property->default_value)); + if (property->deallocator && + old != WindowPropertyCaster<T>::ToInt64(property->default_value)) { + (*property->deallocator)(old); } -}; +} + +template<typename T> +T Window::GetProperty(const WindowProperty<T>* property) const { + return WindowPropertyCaster<T>::FromInt64(GetPropertyInternal( + property, WindowPropertyCaster<T>::ToInt64(property->default_value))); +} -} // namespace subtle +template<typename T> +void Window::ClearProperty(const WindowProperty<T>* property) { + SetProperty(property, property->default_value); +} } // namespace aura // Macros to instantiate the property getter/setter template functions. #define DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(EXPORT, T) \ - template<> EXPORT void aura::Window::SetProperty( \ - const aura::WindowProperty<T >* property, T value) { \ - subtle::PropertyHelper::Set<T>(this, property, value); \ - } \ - template<> EXPORT T aura::Window::GetProperty( \ - const aura::WindowProperty<T >* property) const { \ - return subtle::PropertyHelper::Get<T>(this, property); \ - } \ - template<> EXPORT void aura::Window::ClearProperty( \ - const aura::WindowProperty<T >* property) { \ - subtle::PropertyHelper::Clear<T>(this, property); \ - } + template EXPORT void aura::Window::SetProperty( \ + const aura::WindowProperty<T >*, T); \ + template EXPORT T aura::Window::GetProperty( \ + const aura::WindowProperty<T >*) const; \ + template EXPORT void aura::Window::ClearProperty( \ + const aura::WindowProperty<T >*); #define DECLARE_WINDOW_PROPERTY_TYPE(T) \ DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, T) #define DEFINE_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ - COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large); \ - namespace { \ - const aura::WindowProperty<TYPE> NAME ## _Value = \ - {DEFAULT, #NAME, nullptr}; \ - } \ + COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large); \ + namespace { \ + const aura::WindowProperty<TYPE> NAME ## _Value = {DEFAULT, #NAME, NULL}; \ + } \ const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; #define DEFINE_LOCAL_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ - COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large); \ - namespace { \ - const aura::WindowProperty<TYPE> NAME ## _Value = \ - {DEFAULT, #NAME, nullptr}; \ - const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; \ + COMPILE_ASSERT(sizeof(TYPE) <= sizeof(int64), property_type_too_large); \ + namespace { \ + const aura::WindowProperty<TYPE> NAME ## _Value = {DEFAULT, #NAME, NULL}; \ + const aura::WindowProperty<TYPE>* const NAME = & NAME ## _Value; \ } #define DEFINE_OWNED_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \ diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 31bbf13..7276113 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -45,29 +45,7 @@ #include "ui/gfx/vector2d.h" DECLARE_WINDOW_PROPERTY_TYPE(const char*) - -namespace { - -class TestProperty { - public: - TestProperty() {} - ~TestProperty() { - last_deleted_ = this; - } - static TestProperty* last_deleted() { return last_deleted_; } - - private: - static TestProperty* last_deleted_; - DISALLOW_COPY_AND_ASSIGN(TestProperty); -}; - -TestProperty* TestProperty::last_deleted_ = nullptr; - -DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); - -} // namespace - -DECLARE_WINDOW_PROPERTY_TYPE(TestProperty*); +DECLARE_WINDOW_PROPERTY_TYPE(int) namespace aura { namespace test { @@ -1604,6 +1582,27 @@ TEST_F(WindowTest, Property) { EXPECT_EQ(std::string("squeamish"), w->GetProperty(kStringKey)); } +namespace { + +class TestProperty { + public: + TestProperty() {} + virtual ~TestProperty() { + last_deleted_ = this; + } + static TestProperty* last_deleted() { return last_deleted_; } + + private: + static TestProperty* last_deleted_; + DISALLOW_COPY_AND_ASSIGN(TestProperty); +}; + +TestProperty* TestProperty::last_deleted_ = NULL; + +DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); + +} // namespace + TEST_F(WindowTest, OwnedProperty) { scoped_ptr<Window> w(CreateTestWindowWithId(0, root_window())); EXPECT_EQ(NULL, w->GetProperty(kOwnedKey)); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index 0f7c92f..3752373 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -40,8 +40,6 @@ #include "ui/wm/core/window_animations.h" #include "ui/wm/public/scoped_tooltip_disabler.h" -DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); - namespace views { namespace { diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index 5699a72..dd8aa40 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc @@ -53,8 +53,6 @@ #include "ui/wm/core/compound_event_filter.h" #include "ui/wm/core/window_util.h" -DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostX11*); - namespace views { DesktopWindowTreeHostX11* DesktopWindowTreeHostX11::g_current_capture = diff --git a/ui/wm/core/transient_window_manager.cc b/ui/wm/core/transient_window_manager.cc index 2ca145d..923f4a2 100644 --- a/ui/wm/core/transient_window_manager.cc +++ b/ui/wm/core/transient_window_manager.cc @@ -17,8 +17,6 @@ using aura::Window; -DECLARE_WINDOW_PROPERTY_TYPE(wm::TransientWindowManager*); - namespace wm { namespace { diff --git a/ui/wm/core/window_animations.cc b/ui/wm/core/window_animations.cc index fb671bb..03bb1b9 100644 --- a/ui/wm/core/window_animations.cc +++ b/ui/wm/core/window_animations.cc @@ -38,9 +38,11 @@ #include "ui/wm/core/wm_core_switches.h" #include "ui/wm/public/animation_host.h" +DECLARE_WINDOW_PROPERTY_TYPE(int) DECLARE_WINDOW_PROPERTY_TYPE(wm::WindowVisibilityAnimationType) DECLARE_WINDOW_PROPERTY_TYPE(wm::WindowVisibilityAnimationTransition) DECLARE_WINDOW_PROPERTY_TYPE(float) +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(WM_EXPORT, bool) namespace wm { namespace { |