diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 21:14:29 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 21:14:29 +0000 |
commit | 3e14cad77812fbf6606d951b60eebd4f566680db (patch) | |
tree | 8bd39772f6ae369e9ca282a750dd61b3e81e65d5 /ui | |
parent | 098b2911b28bbfabde8fe38cfa45f2d6c94e2c6e (diff) | |
download | chromium_src-3e14cad77812fbf6606d951b60eebd4f566680db.zip chromium_src-3e14cad77812fbf6606d951b60eebd4f566680db.tar.gz chromium_src-3e14cad77812fbf6606d951b60eebd4f566680db.tar.bz2 |
Shell related switches -> aura shell switches.
Aura client window properties->client namespace.
Move WindowType to client.
BUG=none
TEST=existing automation
TBR=sky
Review URL: http://codereview.chromium.org/8968022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115182 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
52 files changed, 250 insertions, 206 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index f8c9036..ae2e8a7 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -33,12 +33,13 @@ 'client/aura_constants.h', 'client/drag_drop_client.cc', 'client/drag_drop_client.h', + 'client/drag_drop_delegate.cc', + 'client/drag_drop_delegate.h', 'client/stacking_client.cc', 'client/stacking_client.h', 'client/tooltip_client.cc', 'client/tooltip_client.h', - 'client/drag_drop_delegate.cc', - 'client/drag_drop_delegate.h', + 'client/window_types.h', 'cursor.h', 'root_window_host.h', 'root_window_host_linux.cc', @@ -59,7 +60,6 @@ 'window.h', 'window_delegate.h', 'window_observer.h', - 'window_types.h', ], }, { diff --git a/ui/aura/aura_switches.cc b/ui/aura/aura_switches.cc index 4ce9fd3..7ef842f 100644 --- a/ui/aura/aura_switches.cc +++ b/ui/aura/aura_switches.cc @@ -11,30 +11,4 @@ namespace switches { // Initial dimensions for the host window in the form "1024x768". const char kAuraHostWindowSize[] = "aura-host-window-size"; -// Avoid drawing drop shadows under windows. -const char kAuraNoShadows[] = "aura-no-shadows"; - -// Use Aura-style translucent window frame. -const char kAuraTranslucentFrames[] = "aura-translucent-frames"; - -// Use a custom window style, e.g. --aura-window-mode=compact. -// When this flag is not passed we default to "normal" mode. -const char kAuraWindowMode[] = "aura-window-mode"; - -// Show only a single maximized window, like traditional non-Aura builds. -// Useful for low-resolution screens, such as on laptops. -const char kAuraWindowModeCompact[] = "compact"; - -// Default window management with multiple draggable windows. -const char kAuraWindowModeNormal[] = "normal"; - -// Use Aura-style workspace window dragging and sizing. -const char kAuraWorkspaceManager[] = "aura-workspace-manager"; - -bool IsAuraWindowModeCompact() { - std::string mode = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kAuraWindowMode); - return mode == switches::kAuraWindowModeCompact; -} - } // namespace switches diff --git a/ui/aura/aura_switches.h b/ui/aura/aura_switches.h index dcb49ff..ab66e6a 100644 --- a/ui/aura/aura_switches.h +++ b/ui/aura/aura_switches.h @@ -12,15 +12,6 @@ namespace switches { // Please keep alphabetized. AURA_EXPORT extern const char kAuraHostWindowSize[]; -AURA_EXPORT extern const char kAuraNoShadows[]; -AURA_EXPORT extern const char kAuraTranslucentFrames[]; -AURA_EXPORT extern const char kAuraWindowMode[]; -AURA_EXPORT extern const char kAuraWindowModeCompact[]; -AURA_EXPORT extern const char kAuraWindowModeNormal[]; -AURA_EXPORT extern const char kAuraWorkspaceManager[]; - -// Utilities for testing multi-valued switches. -AURA_EXPORT bool IsAuraWindowModeCompact(); } // namespace switches diff --git a/ui/aura/client/activation_client.cc b/ui/aura/client/activation_client.cc index bbb9bcc..3374a15 100644 --- a/ui/aura/client/activation_client.cc +++ b/ui/aura/client/activation_client.cc @@ -4,12 +4,14 @@ #include "ui/aura/client/activation_client.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" namespace aura { namespace client { +const char kRootWindowActivationClient[] = "RootWindowActivationClient"; +const char kRootWindowActiveWindow[] = "RootWindowActiveWindow"; + void SetActivationClient(ActivationClient* client) { RootWindow::GetInstance()->SetProperty(kRootWindowActivationClient, client); } diff --git a/ui/aura/client/activation_client.h b/ui/aura/client/activation_client.h index c75a1e5..aba438e 100644 --- a/ui/aura/client/activation_client.h +++ b/ui/aura/client/activation_client.h @@ -12,6 +12,14 @@ namespace aura { class Window; namespace client { +// A property key to store a client that handles window activation. The type of +// the value is |aura::client::ActivationClient*|. +AURA_EXPORT extern const char kRootWindowActivationClient[]; + +// A property key to store what the client defines as the active window on the +// RootWindow. The type of the value is |aura::Window*|. +AURA_EXPORT extern const char kRootWindowActiveWindow[]; + // An interface implemented by an object that manages window activation. class AURA_EXPORT ActivationClient { public: diff --git a/ui/aura/client/activation_delegate.cc b/ui/aura/client/activation_delegate.cc index 734a4da..c1faed1 100644 --- a/ui/aura/client/activation_delegate.cc +++ b/ui/aura/client/activation_delegate.cc @@ -4,12 +4,13 @@ #include "ui/aura/client/activation_delegate.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" namespace aura { namespace client { +const char kActivationDelegateKey[] = "ActivationDelegate"; + void SetActivationDelegate(Window* window, ActivationDelegate* delegate) { window->SetProperty(kActivationDelegateKey, delegate); } diff --git a/ui/aura/client/activation_delegate.h b/ui/aura/client/activation_delegate.h index b711cbd..5a5a4fb 100644 --- a/ui/aura/client/activation_delegate.h +++ b/ui/aura/client/activation_delegate.h @@ -13,6 +13,10 @@ class Event; class Window; namespace client { +// A property key to store the activation delegate for a window. The type of the +// value is |aura::ActivationDelegate*|. +AURA_EXPORT extern const char kActivationDelegateKey[]; + // An interface implemented by an object that configures and responds to changes // to a window's activation state. class AURA_EXPORT ActivationDelegate { diff --git a/ui/aura/client/aura_constants.cc b/ui/aura/client/aura_constants.cc index 9267a1f..3a6ceab 100644 --- a/ui/aura/client/aura_constants.cc +++ b/ui/aura/client/aura_constants.cc @@ -5,20 +5,14 @@ #include "ui/aura/client/aura_constants.h" namespace aura { +namespace client { // Alphabetical sort. -const char kActivationDelegateKey[] = "ActivationDelegate"; const char kAlwaysOnTopKey[] = "AlwaysOnTop"; -const char kDragDropDelegateKey[] = "DragDropDelegate"; const char kModalKey[] = "Modal"; const char kRestoreBoundsKey[] = "RestoreBounds"; -const char kRootWindowActivationClient[] = "RootWindowActivationClient"; -const char kRootWindowActiveWindow[] = "RootWindowActiveWindow"; -const char kRootWindowDragDropClientKey[] = "RootWindowDragDropClient"; -const char kRootWindowStackingClient[] = "RootWindowStackingClient"; -const char kRootWindowTooltipClientKey[] = "RootWindowTooltipClient"; const char kShowStateKey[] = "ShowState"; -const char kTooltipTextKey[] = "TooltipText"; // Alphabetical sort. +} // namespace client } // namespace aura diff --git a/ui/aura/client/aura_constants.h b/ui/aura/client/aura_constants.h index 5240c19..d8871a1 100644 --- a/ui/aura/client/aura_constants.h +++ b/ui/aura/client/aura_constants.h @@ -9,20 +9,13 @@ #include "ui/aura/aura_export.h" namespace aura { +namespace client { // Alphabetical sort. -// A property key to store the activation delegate for a window. The type of the -// value is |aura::ActivationDelegate*|. -AURA_EXPORT extern const char kActivationDelegateKey[]; - // A property key to store always-on-top flag. The type of the value is boolean. AURA_EXPORT extern const char kAlwaysOnTopKey[]; -// A property key to store the drag and drop delegate for a window. The type of -// the value is |aura::WindowDragDropDelegate*|. -AURA_EXPORT extern const char kDragDropDelegateKey[]; - // A property key to store the boolean property of window modality. AURA_EXPORT extern const char kModalKey[]; @@ -30,36 +23,13 @@ AURA_EXPORT extern const char kModalKey[]; // of the value is |gfx::Rect*|. AURA_EXPORT extern const char kRestoreBoundsKey[]; -// A property key to store a client that handles window activation. The type of -// the value is |aura::client::ActivationClient*|. -AURA_EXPORT extern const char kRootWindowActivationClient[]; - -// A property key to store what the client defines as the active window on the -// RootWindow. The type of the value is |aura::Window*|. -AURA_EXPORT extern const char kRootWindowActiveWindow[]; - -// A property key to store the drag and drop client for the root window. The -// type of the value is |aura::DragDropClient*|. -AURA_EXPORT extern const char kRootWindowDragDropClientKey[]; - -// A property key to store a client that handles window parenting. The type of -// the value is |aura::client::StackingClient*|. -AURA_EXPORT extern const char kRootWindowStackingClient[]; - -// A property key to store the tooltip client for the root window. The type of -// the value is |aura::client::TooltipClient*|. -AURA_EXPORT extern const char kRootWindowTooltipClientKey[]; - // A property key to store ui::WindowShowState for a window. // See ui/base/ui_base_types.h for its definition. AURA_EXPORT extern const char kShowStateKey[]; -// A property key to store tooltip text for a window. The type of the value -// is |string16*|. -AURA_EXPORT extern const char kTooltipTextKey[]; - // Alphabetical sort. +} // namespace client } // namespace aura #endif // UI_AURA_CLIENT_AURA_CONSTANTS_H_ diff --git a/ui/aura/client/drag_drop_client.cc b/ui/aura/client/drag_drop_client.cc index 250340d..607b67d 100644 --- a/ui/aura/client/drag_drop_client.cc +++ b/ui/aura/client/drag_drop_client.cc @@ -4,12 +4,13 @@ #include "ui/aura/client/drag_drop_client.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" namespace aura { namespace client { +const char kRootWindowDragDropClientKey[] = "RootWindowDragDropClient"; + void SetDragDropClient(DragDropClient* client) { RootWindow::GetInstance()->SetProperty(kRootWindowDragDropClientKey, client); } diff --git a/ui/aura/client/drag_drop_client.h b/ui/aura/client/drag_drop_client.h index 92dd34b..b45c604 100644 --- a/ui/aura/client/drag_drop_client.h +++ b/ui/aura/client/drag_drop_client.h @@ -17,6 +17,10 @@ namespace aura { class Window; namespace client { +// A property key to store the drag and drop client for the root window. The +// type of the value is |aura::DragDropClient*|. +AURA_EXPORT extern const char kRootWindowDragDropClientKey[]; + // An interface implemented by an object that controls a drag and drop session. class AURA_EXPORT DragDropClient { public: diff --git a/ui/aura/client/drag_drop_delegate.cc b/ui/aura/client/drag_drop_delegate.cc index 1d9f9d4..1cc75f6 100644 --- a/ui/aura/client/drag_drop_delegate.cc +++ b/ui/aura/client/drag_drop_delegate.cc @@ -4,12 +4,13 @@ #include "ui/aura/client/drag_drop_delegate.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" namespace aura { namespace client { +const char kDragDropDelegateKey[] = "DragDropDelegate"; + void SetDragDropDelegate(Window* window, DragDropDelegate* delegate) { window->SetProperty(kDragDropDelegateKey, delegate); } diff --git a/ui/aura/client/drag_drop_delegate.h b/ui/aura/client/drag_drop_delegate.h index 4a568b76..9b9f98f 100644 --- a/ui/aura/client/drag_drop_delegate.h +++ b/ui/aura/client/drag_drop_delegate.h @@ -13,6 +13,10 @@ class DropTargetEvent; class Window; namespace client { +// A property key to store the drag and drop delegate for a window. The type of +// the value is |aura::WindowDragDropDelegate*|. +AURA_EXPORT extern const char kDragDropDelegateKey[]; + // Delegate interface for drag and drop actions on aura::Window. class AURA_EXPORT DragDropDelegate { public: diff --git a/ui/aura/client/stacking_client.cc b/ui/aura/client/stacking_client.cc index f056a07..a38719c 100644 --- a/ui/aura/client/stacking_client.cc +++ b/ui/aura/client/stacking_client.cc @@ -4,12 +4,13 @@ #include "ui/aura/client/stacking_client.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" namespace aura { namespace client { +const char kRootWindowStackingClient[] = "RootWindowStackingClient"; + void SetStackingClient(StackingClient* stacking_client) { RootWindow::GetInstance()->SetProperty(kRootWindowStackingClient, stacking_client); diff --git a/ui/aura/client/stacking_client.h b/ui/aura/client/stacking_client.h index 55e64be..ad7603c 100644 --- a/ui/aura/client/stacking_client.h +++ b/ui/aura/client/stacking_client.h @@ -12,6 +12,10 @@ namespace aura { class Window; namespace client { +// A property key to store a client that handles window parenting. The type of +// the value is |aura::client::StackingClient*|. +AURA_EXPORT extern const char kRootWindowStackingClient[]; + // An interface implemented by an object that stacks windows. class AURA_EXPORT StackingClient { public: diff --git a/ui/aura/client/tooltip_client.cc b/ui/aura/client/tooltip_client.cc index 273eff16..2833a3b 100644 --- a/ui/aura/client/tooltip_client.cc +++ b/ui/aura/client/tooltip_client.cc @@ -4,12 +4,14 @@ #include "ui/aura/client/tooltip_client.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" namespace aura { namespace client { +const char kRootWindowTooltipClientKey[] = "RootWindowTooltipClient"; +const char kTooltipTextKey[] = "TooltipText"; + void SetTooltipClient(TooltipClient* client) { RootWindow::GetInstance()->SetProperty(kRootWindowTooltipClientKey, client); } diff --git a/ui/aura/client/tooltip_client.h b/ui/aura/client/tooltip_client.h index ca1afb3..a290796 100644 --- a/ui/aura/client/tooltip_client.h +++ b/ui/aura/client/tooltip_client.h @@ -14,6 +14,14 @@ namespace aura { class Window; namespace client { +// A property key to store the tooltip client for the root window. The type of +// the value is |aura::client::TooltipClient*|. +AURA_EXPORT extern const char kRootWindowTooltipClientKey[]; + +// A property key to store tooltip text for a window. The type of the value +// is |string16*|. +AURA_EXPORT extern const char kTooltipTextKey[]; + class AURA_EXPORT TooltipClient { public: // Informs the shell tooltip manager of change in tooltip for window |target|. diff --git a/ui/aura/window_types.h b/ui/aura/client/window_types.h index 101460a..d1375df 100644 --- a/ui/aura/window_types.h +++ b/ui/aura/client/window_types.h @@ -7,20 +7,25 @@ #pragma once namespace aura { +namespace client { +// This isn't a property because it can't change after the window has been +// initialized. It's in client because the Aura Client application derives +// meaning from these values, not Aura itself. enum WindowType { WINDOW_TYPE_UNKNOWN = 0, - // Regular windows that should be laid out by the shell. + // Regular windows that should be laid out by the client. WINDOW_TYPE_NORMAL, - // Miscellaneous windows that should not be laid out by the shell. + // Miscellaneous windows that should not be laid out by the client. WINDOW_TYPE_POPUP, WINDOW_TYPE_MENU, WINDOW_TYPE_TOOLTIP, }; +} // namespace client } // namespace aura #endif // UI_AURA_WINDOW_TYPES_H_ diff --git a/ui/aura/test/test_windows.cc b/ui/aura/test/test_windows.cc index 98e5335..10aa994 100644 --- a/ui/aura/test/test_windows.cc +++ b/ui/aura/test/test_windows.cc @@ -33,14 +33,14 @@ Window* CreateTestWindowWithDelegate(WindowDelegate* delegate, Window* parent) { return CreateTestWindowWithDelegateAndType( delegate, - aura::WINDOW_TYPE_NORMAL, + aura::client::WINDOW_TYPE_NORMAL, id, bounds, parent); } Window* CreateTestWindowWithDelegateAndType(WindowDelegate* delegate, - WindowType type, + client::WindowType type, int id, const gfx::Rect& bounds, Window* parent) { diff --git a/ui/aura/test/test_windows.h b/ui/aura/test/test_windows.h index 23b6456..1781104 100644 --- a/ui/aura/test/test_windows.h +++ b/ui/aura/test/test_windows.h @@ -8,9 +8,9 @@ #include "base/compiler_specific.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/aura/client/window_types.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/aura_test_base.h" -#include "ui/aura/window_types.h" namespace aura { namespace test { @@ -26,7 +26,7 @@ Window* CreateTestWindowWithDelegate(WindowDelegate* delegate, const gfx::Rect& bounds, Window* parent); Window* CreateTestWindowWithDelegateAndType(WindowDelegate* delegate, - WindowType type, + client::WindowType type, int id, const gfx::Rect& bounds, Window* parent); diff --git a/ui/aura/window.cc b/ui/aura/window.cc index e151f80..f985944 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -16,7 +16,6 @@ #include "ui/aura/root_window.h" #include "ui/aura/window_delegate.h" #include "ui/aura/window_observer.h" -#include "ui/aura/window_types.h" #include "ui/base/animation/multi_animation.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/compositor/compositor.h" @@ -37,7 +36,7 @@ Window* GetParentForWindow(Window* window, Window* suggested_parent) { } // namespace Window::Window(WindowDelegate* delegate) - : type_(WINDOW_TYPE_UNKNOWN), + : type_(client::WINDOW_TYPE_UNKNOWN), delegate_(delegate), parent_(NULL), transient_parent_(NULL), @@ -95,7 +94,7 @@ void Window::Init(ui::Layer::LayerType layer_type) { RootWindow::GetInstance()->WindowInitialized(this); } -void Window::SetType(WindowType type) { +void Window::SetType(client::WindowType type) { // Cannot change type after the window is initialized. DCHECK(!layer()); type_ = type; diff --git a/ui/aura/window.h b/ui/aura/window.h index dcd115d..a97194c 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -16,7 +16,7 @@ #include "base/string16.h" #include "ui/base/events.h" #include "ui/aura/aura_export.h" -#include "ui/aura/window_types.h" +#include "ui/aura/client/window_types.h" #include "ui/gfx/compositor/layer.h" #include "ui/gfx/compositor/layer_animator.h" #include "ui/gfx/compositor/layer_delegate.h" @@ -57,8 +57,8 @@ class AURA_EXPORT Window : public ui::LayerDelegate { // A type is used to identify a class of Windows and customize behavior such // as event handling and parenting. This field should only be consumed by the // shell -- Aura itself shouldn't contain type-specific logic. - WindowType type() const { return type_; } - void SetType(WindowType type); + client::WindowType type() const { return type_; } + void SetType(client::WindowType type); int id() const { return id_; } void set_id(int id) { id_ = id; } @@ -298,7 +298,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate { // Updates the layer name with a name based on the window's name and id. void UpdateLayerName(const std::string& name); - WindowType type_; + client::WindowType type_; WindowDelegate* delegate_; diff --git a/ui/aura_shell/activation_controller.cc b/ui/aura_shell/activation_controller.cc index 68d702e..7e7d668 100644 --- a/ui/aura_shell/activation_controller.cc +++ b/ui/aura_shell/activation_controller.cc @@ -6,7 +6,6 @@ #include "base/auto_reset.h" #include "ui/aura/client/activation_delegate.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -97,8 +96,9 @@ void ActivationController::ActivateWindow(aura::Window* window) { if (!window->Contains(window->GetFocusManager()->GetFocusedWindow())) window->GetFocusManager()->SetFocusedWindow(window); - aura::RootWindow::GetInstance()->SetProperty(aura::kRootWindowActiveWindow, - window); + aura::RootWindow::GetInstance()->SetProperty( + aura::client::kRootWindowActiveWindow, + window); // Invoke OnLostActive after we've changed the active window. That way if the // delegate queries for active state it doesn't think the window is still // active. @@ -119,7 +119,7 @@ void ActivationController::DeactivateWindow(aura::Window* window) { aura::Window* ActivationController::GetActiveWindow() { return reinterpret_cast<aura::Window*>( aura::RootWindow::GetInstance()->GetProperty( - aura::kRootWindowActiveWindow)); + aura::client::kRootWindowActiveWindow)); } bool ActivationController::CanFocusWindow(aura::Window* window) const { @@ -140,8 +140,9 @@ void ActivationController::OnWindowDestroyed(aura::Window* window) { // Clear the property before activating something else, since // ActivateWindow() will attempt to notify the window stored in this value // otherwise. - aura::RootWindow::GetInstance()->SetProperty(aura::kRootWindowActiveWindow, - NULL); + aura::RootWindow::GetInstance()->SetProperty( + aura::client::kRootWindowActiveWindow, + NULL); ActivateWindow(GetTopmostWindowToActivate(window)); } window->RemoveObserver(this); diff --git a/ui/aura_shell/activation_controller_unittest.cc b/ui/aura_shell/activation_controller_unittest.cc index b5529cd..c308d17 100644 --- a/ui/aura_shell/activation_controller_unittest.cc +++ b/ui/aura_shell/activation_controller_unittest.cc @@ -4,7 +4,6 @@ #include "ui/aura_shell/activation_controller.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/focus_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" @@ -139,7 +138,7 @@ TEST_F(ActivationControllerTest, ClickOnMenu) { // Creates a menu that covers the transient parent. scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType( - &wd, aura::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL)); + &wd, aura::client::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL)); ad2.SetWindow(menu.get()); w1->AddTransientChild(menu.get()); diff --git a/ui/aura_shell/always_on_top_controller.cc b/ui/aura_shell/always_on_top_controller.cc index 5c73488..def6210 100644 --- a/ui/aura_shell/always_on_top_controller.cc +++ b/ui/aura_shell/always_on_top_controller.cc @@ -6,7 +6,6 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" -#include "ui/aura/window_types.h" namespace aura_shell { namespace internal { @@ -41,8 +40,8 @@ void AlwaysOnTopController::SetContainers(aura::Window* default_container, aura::Window* AlwaysOnTopController::GetContainer(aura::Window* window) const { DCHECK(default_container_ && always_on_top_container_); - return !window->GetProperty(aura::kAlwaysOnTopKey) ? default_container_ : - always_on_top_container_; + return !window->GetProperty(aura::client::kAlwaysOnTopKey) ? + default_container_ : always_on_top_container_; } void AlwaysOnTopController::OnWindowAdded(aura::Window* child) { @@ -60,9 +59,9 @@ void AlwaysOnTopController::OnWillRemoveWindow(aura::Window* child) { void AlwaysOnTopController::OnWindowPropertyChanged(aura::Window* window, const char* name, void* old) { - if (name == aura::kAlwaysOnTopKey) { - DCHECK(window->type() == aura::WINDOW_TYPE_NORMAL || - window->type() == aura::WINDOW_TYPE_POPUP); + if (name == aura::client::kAlwaysOnTopKey) { + DCHECK(window->type() == aura::client::WINDOW_TYPE_NORMAL || + window->type() == aura::client::WINDOW_TYPE_POPUP); aura::Window* container = GetContainer(window); if (window->parent() != container) container->AddChild(window); diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp index d7ea004..1f86119 100644 --- a/ui/aura_shell/aura_shell.gyp +++ b/ui/aura_shell/aura_shell.gyp @@ -39,6 +39,8 @@ 'always_on_top_controller.h', 'app_list.cc', 'app_list.h', + 'aura_shell_switches.cc', + 'aura_shell_switches.h', 'compact_layout_manager.cc', 'compact_layout_manager.h', 'compact_status_area_layout_manager.cc', diff --git a/ui/aura_shell/aura_shell_switches.cc b/ui/aura_shell/aura_shell_switches.cc new file mode 100644 index 0000000..aee6bf3 --- /dev/null +++ b/ui/aura_shell/aura_shell_switches.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2011 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/aura_shell/aura_shell_switches.h" + +#include <string> + +#include "base/command_line.h" + +namespace aura_shell { +namespace switches { + +// Avoid drawing drop shadows under windows. +const char kAuraNoShadows[] = "aura-no-shadows"; + +// Use Aura-style translucent window frame. +const char kAuraTranslucentFrames[] = "aura-translucent-frames"; + +// Use a custom window style, e.g. --aura-window-mode=compact. +// When this flag is not passed we default to "normal" mode. +const char kAuraWindowMode[] = "aura-window-mode"; + +// Show only a single maximized window, like traditional non-Aura builds. +// Useful for low-resolution screens, such as on laptops. +const char kAuraWindowModeCompact[] = "compact"; + +// Default window management with multiple draggable windows. +const char kAuraWindowModeNormal[] = "normal"; + +// Use Aura-style workspace window dragging and sizing. +const char kAuraWorkspaceManager[] = "aura-workspace-manager"; + +bool IsAuraWindowModeCompact() { + std::string mode = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kAuraWindowMode); + return mode == switches::kAuraWindowModeCompact; +} + +} // namespace switches +} // namespace aura_shell diff --git a/ui/aura_shell/aura_shell_switches.h b/ui/aura_shell/aura_shell_switches.h new file mode 100644 index 0000000..95adef5 --- /dev/null +++ b/ui/aura_shell/aura_shell_switches.h @@ -0,0 +1,28 @@ +// Copyright (c) 2011 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_AURA_SHELL_AURA_SHELL_SWITCHES_H_ +#define UI_AURA_SHELL_AURA_SHELL_SWITCHES_H_ +#pragma once + +#include "ui/aura_shell/aura_shell_export.h" + +namespace aura_shell { +namespace switches { + +// Please keep alphabetized. +AURA_SHELL_EXPORT extern const char kAuraNoShadows[]; +AURA_SHELL_EXPORT extern const char kAuraTranslucentFrames[]; +AURA_SHELL_EXPORT extern const char kAuraWindowMode[]; +AURA_SHELL_EXPORT extern const char kAuraWindowModeCompact[]; +AURA_SHELL_EXPORT extern const char kAuraWindowModeNormal[]; +AURA_SHELL_EXPORT extern const char kAuraWorkspaceManager[]; + +// Utilities for testing multi-valued switches. +AURA_SHELL_EXPORT bool IsAuraWindowModeCompact(); + +} // namespace switches +} // namespace aura_shell + +#endif // UI_AURA_SHELL_AURA_SHELL_SWITCHES_H_ diff --git a/ui/aura_shell/compact_layout_manager.cc b/ui/aura_shell/compact_layout_manager.cc index 9d158e7..e7b762e 100644 --- a/ui/aura_shell/compact_layout_manager.cc +++ b/ui/aura_shell/compact_layout_manager.cc @@ -27,7 +27,7 @@ void CompactLayoutManager::OnWindowResized() { void CompactLayoutManager::OnWindowAddedToLayout(aura::Window* child) { windows_.insert(child); child->AddObserver(this); - if (child->GetProperty(aura::kShowStateKey)) + if (child->GetProperty(aura::client::kShowStateKey)) UpdateBoundsFromShowState(child); } @@ -47,7 +47,7 @@ void CompactLayoutManager::SetChildBounds( gfx::Rect bounds = requested_bounds; // Avoid a janky resize on startup by ensuring the initial bounds fill the // screen. - if (child->GetIntProperty(aura::kShowStateKey) == ui::SHOW_STATE_MAXIMIZED) + if (IsWindowMaximized(child)) bounds = gfx::Screen::GetPrimaryMonitorBounds(); SetChildBoundsDirect(child, bounds); } @@ -55,7 +55,7 @@ void CompactLayoutManager::SetChildBounds( void CompactLayoutManager::OnWindowPropertyChanged(aura::Window* window, const char* name, void* old) { - if (name == aura::kShowStateKey) + if (name == aura::client::kShowStateKey) UpdateBoundsFromShowState(window); } diff --git a/ui/aura_shell/default_container_layout_manager.cc b/ui/aura_shell/default_container_layout_manager.cc index f3a77e9..d646fec 100644 --- a/ui/aura_shell/default_container_layout_manager.cc +++ b/ui/aura_shell/default_container_layout_manager.cc @@ -10,7 +10,6 @@ #include "ui/aura/screen_aura.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" -#include "ui/aura/window_types.h" #include "ui/aura_shell/property_util.h" #include "ui/aura_shell/show_state_controller.h" #include "ui/aura_shell/window_util.h" @@ -96,11 +95,13 @@ void DefaultContainerLayoutManager::OnWindowResized() { } void DefaultContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { - if (child->type() != aura::WINDOW_TYPE_NORMAL || child->transient_parent()) + if (child->type() != aura::client::WINDOW_TYPE_NORMAL || + child->transient_parent()) { return; + } - if (!child->GetProperty(aura::kShowStateKey)) - child->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + if (!child->GetProperty(aura::client::kShowStateKey)) + child->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); child->AddObserver(show_state_controller_.get()); @@ -144,7 +145,7 @@ void DefaultContainerLayoutManager::SetChildBounds( gfx::Rect adjusted_bounds = requested_bounds; // First, calculate the adjusted bounds. - if (child->type() != aura::WINDOW_TYPE_NORMAL || + if (child->type() != aura::client::WINDOW_TYPE_NORMAL || workspace_manager_->layout_in_progress() || child->transient_parent()) { // Use the requested bounds as is. @@ -163,7 +164,7 @@ void DefaultContainerLayoutManager::SetChildBounds( } ui::WindowShowState show_state = static_cast<ui::WindowShowState>( - child->GetIntProperty(aura::kShowStateKey)); + child->GetIntProperty(aura::client::kShowStateKey)); // Second, check if the window is either maximized or in fullscreen mode. if (show_state == ui::SHOW_STATE_MAXIMIZED || diff --git a/ui/aura_shell/default_container_layout_manager_unittest.cc b/ui/aura_shell/default_container_layout_manager_unittest.cc index 0cc0e89..d9cb80c 100644 --- a/ui/aura_shell/default_container_layout_manager_unittest.cc +++ b/ui/aura_shell/default_container_layout_manager_unittest.cc @@ -47,7 +47,7 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { aura::Window* CreateTestWindowWithType(const gfx::Rect& bounds, aura::Window* parent, - aura::WindowType type) { + aura::client::WindowType type) { aura::Window* window = new aura::Window(NULL); window->SetType(type); window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); @@ -61,7 +61,7 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { aura::Window* parent) { return CreateTestWindowWithType(bounds, parent, - aura::WINDOW_TYPE_NORMAL); + aura::client::WINDOW_TYPE_NORMAL); } aura::Window* container() { return container_.get(); } @@ -87,20 +87,21 @@ class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { // Utility functions to set and get show state on |window|. void Maximize(aura::Window* window) { - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); + window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); } void Fullscreen(aura::Window* window) { - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); + window->SetIntProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_FULLSCREEN); } void Restore(aura::Window* window) { - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); } ui::WindowShowState GetShowState(aura::Window* window) { return static_cast<ui::WindowShowState>( - window->GetIntProperty(aura::kShowStateKey)); + window->GetIntProperty(aura::client::kShowStateKey)); } } // namespace @@ -147,7 +148,7 @@ TEST_F(DefaultContainerLayoutManagerTest, Popup) { scoped_ptr<aura::Window> popup( CreateTestWindowWithType(gfx::Rect(0, -1000, 100, 100), container(), - aura::WINDOW_TYPE_POPUP)); + aura::client::WINDOW_TYPE_POPUP)); // A popup window can be placed outside of draggable area. EXPECT_EQ("0,-1000 100x100", popup->bounds().ToString()); @@ -164,7 +165,7 @@ TEST_F(DefaultContainerLayoutManagerTest, Popup) { // manager. TEST_F(DefaultContainerLayoutManagerTest, IgnoreTransient) { scoped_ptr<aura::Window> window(new aura::Window(NULL)); - window->SetType(aura::WINDOW_TYPE_NORMAL); + window->SetType(aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); aura::RootWindow::GetInstance()->AddTransientChild(window.get()); window->SetBounds(gfx::Rect(0, 0, 200, 200)); @@ -190,7 +191,7 @@ TEST_F(DefaultContainerLayoutManagerTest, Fullscreen) { Fullscreen(w.get()); EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, GetShowState(w.get())); EXPECT_EQ(fullscreen_bounds.ToString(), w->bounds().ToString()); - w->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + w->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_EQ(ui::SHOW_STATE_NORMAL, GetShowState(w.get())); EXPECT_EQ(original_bounds.ToString(), w->bounds().ToString()); diff --git a/ui/aura_shell/drag_drop_controller.cc b/ui/aura_shell/drag_drop_controller.cc index 7cecb49..6c7dd25 100644 --- a/ui/aura_shell/drag_drop_controller.cc +++ b/ui/aura_shell/drag_drop_controller.cc @@ -5,7 +5,6 @@ #include "ui/aura_shell/drag_drop_controller.h" #include "base/message_loop.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/drag_drop_delegate.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" diff --git a/ui/aura_shell/drag_drop_controller_unittest.cc b/ui/aura_shell/drag_drop_controller_unittest.cc index f05ca81..fab1b590 100644 --- a/ui/aura_shell/drag_drop_controller_unittest.cc +++ b/ui/aura_shell/drag_drop_controller_unittest.cc @@ -6,7 +6,6 @@ #include "base/location.h" #include "base/utf_string_conversions.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura_shell/root_window_event_filter.h" diff --git a/ui/aura_shell/modal_container_layout_manager.cc b/ui/aura_shell/modal_container_layout_manager.cc index ccf5f7d..6be8ebc 100644 --- a/ui/aura_shell/modal_container_layout_manager.cc +++ b/ui/aura_shell/modal_container_layout_manager.cc @@ -66,14 +66,14 @@ void ModalContainerLayoutManager::OnWindowResized() { void ModalContainerLayoutManager::OnWindowAddedToLayout( aura::Window* child) { child->AddObserver(this); - if (child->GetIntProperty(aura::kModalKey)) + if (child->GetIntProperty(aura::client::kModalKey)) AddModalWindow(child); } void ModalContainerLayoutManager::OnWillRemoveWindowFromLayout( aura::Window* child) { child->RemoveObserver(this); - if (child->GetIntProperty(aura::kModalKey)) + if (child->GetIntProperty(aura::client::kModalKey)) RemoveModalWindow(child); } @@ -94,10 +94,10 @@ void ModalContainerLayoutManager::SetChildBounds( void ModalContainerLayoutManager::OnWindowPropertyChanged(aura::Window* window, const char* key, void* old) { - if (key != aura::kModalKey) + if (key != aura::client::kModalKey) return; - if (window->GetIntProperty(aura::kModalKey)) { + if (window->GetIntProperty(aura::client::kModalKey)) { AddModalWindow(window); } else if (static_cast<int>(reinterpret_cast<intptr_t>(old))) { RemoveModalWindow(window); diff --git a/ui/aura_shell/property_util.cc b/ui/aura_shell/property_util.cc index 9e992fc..6026b99 100644 --- a/ui/aura_shell/property_util.cc +++ b/ui/aura_shell/property_util.cc @@ -13,7 +13,7 @@ namespace aura_shell { void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) { delete GetRestoreBounds(window); - window->SetProperty(aura::kRestoreBoundsKey, new gfx::Rect(bounds)); + window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds)); } void SetRestoreBoundsIfNotSet(aura::Window* window) { @@ -23,12 +23,12 @@ void SetRestoreBoundsIfNotSet(aura::Window* window) { const gfx::Rect* GetRestoreBounds(aura::Window* window) { return reinterpret_cast<gfx::Rect*>( - window->GetProperty(aura::kRestoreBoundsKey)); + window->GetProperty(aura::client::kRestoreBoundsKey)); } void ClearRestoreBounds(aura::Window* window) { delete GetRestoreBounds(window); - window->SetProperty(aura::kRestoreBoundsKey, NULL); + window->SetProperty(aura::client::kRestoreBoundsKey, NULL); } } diff --git a/ui/aura_shell/root_window_event_filter_unittest.cc b/ui/aura_shell/root_window_event_filter_unittest.cc index 1fb9e65..b8e1821 100644 --- a/ui/aura_shell/root_window_event_filter_unittest.cc +++ b/ui/aura_shell/root_window_event_filter_unittest.cc @@ -5,7 +5,6 @@ #include "ui/aura_shell/root_window_event_filter.h" #include "ui/aura/client/activation_delegate.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/cursor.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" diff --git a/ui/aura_shell/shadow_controller.cc b/ui/aura_shell/shadow_controller.cc index e5fc770..e813435 100644 --- a/ui/aura_shell/shadow_controller.cc +++ b/ui/aura_shell/shadow_controller.cc @@ -8,10 +8,9 @@ #include "base/command_line.h" #include "base/logging.h" -#include "ui/aura/aura_switches.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" +#include "ui/aura_shell/aura_shell_switches.h" #include "ui/aura_shell/shadow.h" #include "ui/aura_shell/shadow_types.h" #include "ui/aura_shell/window_properties.h" @@ -25,12 +24,12 @@ namespace { ShadowType GetShadowTypeFromWindowType(aura::Window* window) { switch (window->type()) { - case aura::WINDOW_TYPE_NORMAL: + case aura::client::WINDOW_TYPE_NORMAL: return CommandLine::ForCurrentProcess()->HasSwitch( switches::kAuraTranslucentFrames) ? SHADOW_TYPE_NONE : SHADOW_TYPE_RECTANGULAR; - case aura::WINDOW_TYPE_MENU: - case aura::WINDOW_TYPE_TOOLTIP: + case aura::client::WINDOW_TYPE_MENU: + case aura::client::WINDOW_TYPE_TOOLTIP: return SHADOW_TYPE_RECTANGULAR; default: break; diff --git a/ui/aura_shell/shadow_controller_unittest.cc b/ui/aura_shell/shadow_controller_unittest.cc index 7ea8819..b5bbbb8 100644 --- a/ui/aura_shell/shadow_controller_unittest.cc +++ b/ui/aura_shell/shadow_controller_unittest.cc @@ -8,7 +8,6 @@ #include <vector> #include "base/memory/scoped_ptr.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura_shell/shadow.h" @@ -26,7 +25,7 @@ typedef aura_shell::test::AuraShellTestBase ShadowControllerTest; // Tests that various methods in Window update the Shadow object as expected. TEST_F(ShadowControllerTest, Shadow) { scoped_ptr<aura::Window> window(new aura::Window(NULL)); - window->SetType(aura::WINDOW_TYPE_NORMAL); + window->SetType(aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::Layer::LAYER_HAS_TEXTURE); window->SetParent(NULL); @@ -63,7 +62,7 @@ TEST_F(ShadowControllerTest, Shadow) { // Tests that the window's shadow's bounds are updated correctly. TEST_F(ShadowControllerTest, ShadowBounds) { scoped_ptr<aura::Window> window(new aura::Window(NULL)); - window->SetType(aura::WINDOW_TYPE_NORMAL); + window->SetType(aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::Layer::LAYER_HAS_TEXTURE); window->SetParent(NULL); window->Show(); diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc index e5bb3257..087a315 100644 --- a/ui/aura_shell/shell.cc +++ b/ui/aura_shell/shell.cc @@ -8,15 +8,12 @@ #include "base/bind.h" #include "base/command_line.h" -#include "ui/aura/aura_switches.h" -#include "ui/aura/client/aura_constants.h" -#include "ui/aura/client/drag_drop_client.h" #include "ui/aura/root_window.h" #include "ui/aura/layout_manager.h" #include "ui/aura/window.h" -#include "ui/aura/window_types.h" #include "ui/aura_shell/activation_controller.h" #include "ui/aura_shell/app_list.h" +#include "ui/aura_shell/aura_shell_switches.h" #include "ui/aura_shell/compact_layout_manager.h" #include "ui/aura_shell/compact_status_area_layout_manager.h" #include "ui/aura_shell/default_container_event_filter.h" @@ -247,12 +244,12 @@ void Shell::InitLayoutManagers(aura::RootWindow* root_window) { internal::ShelfLayoutManager* shelf_layout_manager = new internal::ShelfLayoutManager(launcher_->widget(), status_widget); - GetContainer(aura_shell::internal::kShellWindowId_LauncherContainer)-> + GetContainer(internal::kShellWindowId_LauncherContainer)-> SetLayoutManager(shelf_layout_manager); internal::StatusAreaLayoutManager* status_area_layout_manager = new internal::StatusAreaLayoutManager(shelf_layout_manager); - GetContainer(aura_shell::internal::kShellWindowId_StatusContainer)-> + GetContainer(internal::kShellWindowId_StatusContainer)-> SetLayoutManager(status_area_layout_manager); // Workspace manager has its own layout managers. @@ -271,7 +268,7 @@ void Shell::InitLayoutManagers(aura::RootWindow* root_window) { aura::Window* Shell::GetContainer(int container_id) { return const_cast<aura::Window*>( - const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); + const_cast<const Shell*>(this)->GetContainer(container_id)); } const aura::Window* Shell::GetContainer(int container_id) const { diff --git a/ui/aura_shell/show_state_controller.cc b/ui/aura_shell/show_state_controller.cc index 34b11c0..ffd3b4a 100644 --- a/ui/aura_shell/show_state_controller.cc +++ b/ui/aura_shell/show_state_controller.cc @@ -25,18 +25,18 @@ ShowStateController::~ShowStateController() { void ShowStateController::OnWindowPropertyChanged(aura::Window* window, const char* name, void* old) { - if (name != aura::kShowStateKey) + if (name != aura::client::kShowStateKey) return; if (window->GetIntProperty(name) == ui::SHOW_STATE_NORMAL) { // Restore the size of window first, then let Workspace layout the window. const gfx::Rect* restore = GetRestoreBounds(window); - window->SetProperty(aura::kRestoreBoundsKey, NULL); + window->SetProperty(aura::client::kRestoreBoundsKey, NULL); if (restore) window->SetBounds(*restore); delete restore; } else if (old == reinterpret_cast<void*>(ui::SHOW_STATE_NORMAL)) { // Store the restore bounds only if previous state is normal. - DCHECK(window->GetProperty(aura::kRestoreBoundsKey) == NULL); + DCHECK(window->GetProperty(aura::client::kRestoreBoundsKey) == NULL); SetRestoreBounds(window, window->GetTargetBounds()); } diff --git a/ui/aura_shell/stacking_controller.cc b/ui/aura_shell/stacking_controller.cc index 3550544..594b676 100644 --- a/ui/aura_shell/stacking_controller.cc +++ b/ui/aura_shell/stacking_controller.cc @@ -20,7 +20,8 @@ aura::Window* GetContainer(int id) { } bool IsWindowModal(aura::Window* window) { - return window->transient_parent() && window->GetIntProperty(aura::kModalKey); + return window->transient_parent() && + window->GetIntProperty(aura::client::kModalKey); } } // namespace @@ -44,13 +45,13 @@ StackingController::~StackingController() { aura::Window* StackingController::GetDefaultParent(aura::Window* window) { switch (window->type()) { - case aura::WINDOW_TYPE_NORMAL: - case aura::WINDOW_TYPE_POPUP: + case aura::client::WINDOW_TYPE_NORMAL: + case aura::client::WINDOW_TYPE_POPUP: if (IsWindowModal(window)) return GetModalContainer(window); return always_on_top_controller_->GetContainer(window); - case aura::WINDOW_TYPE_MENU: - case aura::WINDOW_TYPE_TOOLTIP: + case aura::client::WINDOW_TYPE_MENU: + case aura::client::WINDOW_TYPE_TOOLTIP: return GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); default: NOTREACHED() << "Window " << window->id() diff --git a/ui/aura_shell/tooltip_controller.cc b/ui/aura_shell/tooltip_controller.cc index 8b40db3..56b82a7 100644 --- a/ui/aura_shell/tooltip_controller.cc +++ b/ui/aura_shell/tooltip_controller.cc @@ -10,8 +10,7 @@ #include "base/location.h" #include "base/string_split.h" #include "base/time.h" -#include "ui/aura/aura_switches.h" -#include "ui/aura/client/aura_constants.h" +#include "ui/aura_shell/aura_shell_switches.h" #include "ui/aura/event.h" #include "ui/aura/window.h" #include "ui/aura_shell/shell.h" @@ -156,7 +155,8 @@ class TooltipController::Tooltip { int width = max_width + 2 * kTooltipHorizontalPadding; int height = label_.GetPreferredSize().height() + 2 * kTooltipVerticalPadding; - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows)) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAuraNoShadows)) { width += 2 * kTooltipBorderWidth; height += 2 * kTooltipBorderWidth; } diff --git a/ui/aura_shell/toplevel_layout_manager.cc b/ui/aura_shell/toplevel_layout_manager.cc index b1b87d8a..81f0704 100644 --- a/ui/aura_shell/toplevel_layout_manager.cc +++ b/ui/aura_shell/toplevel_layout_manager.cc @@ -28,7 +28,7 @@ void ToplevelLayoutManager::OnWindowResized() { void ToplevelLayoutManager::OnWindowAddedToLayout(aura::Window* child) { windows_.insert(child); child->AddObserver(this); - if (child->GetProperty(aura::kShowStateKey)) { + if (child->GetProperty(aura::client::kShowStateKey)) { UpdateBoundsFromShowState(child); UpdateShelfVisibility(); } @@ -61,7 +61,7 @@ void ToplevelLayoutManager::SetChildBounds(aura::Window* child, void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, const char* name, void* old) { - if (name == aura::kShowStateKey) { + if (name == aura::client::kShowStateKey) { UpdateBoundsFromShowState(window); UpdateShelfVisibility(); } @@ -73,7 +73,7 @@ void ToplevelLayoutManager::UpdateShelfVisibility() { bool has_fullscreen_window = false; for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) { - if ((*i)->GetIntProperty(aura::kShowStateKey) == + if ((*i)->GetIntProperty(aura::client::kShowStateKey) == ui::SHOW_STATE_FULLSCREEN) { has_fullscreen_window = true; break; diff --git a/ui/aura_shell/toplevel_layout_manager_unittest.cc b/ui/aura_shell/toplevel_layout_manager_unittest.cc index c852395..a28b898 100644 --- a/ui/aura_shell/toplevel_layout_manager_unittest.cc +++ b/ui/aura_shell/toplevel_layout_manager_unittest.cc @@ -58,10 +58,10 @@ class ToplevelLayoutManagerTest : public aura::test::AuraTestBase { TEST_F(ToplevelLayoutManagerTest, Maximize) { gfx::Rect bounds(100, 100, 200, 200); scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); + window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), window->bounds()); - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_EQ(bounds, window->bounds()); } @@ -69,10 +69,11 @@ TEST_F(ToplevelLayoutManagerTest, Maximize) { TEST_F(ToplevelLayoutManagerTest, Fullscreen) { gfx::Rect bounds(100, 100, 200, 200); scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); + window->SetIntProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_FULLSCREEN); EXPECT_EQ(gfx::Screen::GetMonitorAreaNearestWindow(window.get()), window->bounds()); - window->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + window->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_EQ(bounds, window->bounds()); } diff --git a/ui/aura_shell/toplevel_window_event_filter.cc b/ui/aura_shell/toplevel_window_event_filter.cc index f89f622..ae7646a 100644 --- a/ui/aura_shell/toplevel_window_event_filter.cc +++ b/ui/aura_shell/toplevel_window_event_filter.cc @@ -126,7 +126,7 @@ bool IsBottomEdge(int window_component) { } void ToggleMaximizedState(aura::Window* window) { - window->SetIntProperty(aura::kShowStateKey, + window->SetIntProperty(aura::client::kShowStateKey, IsWindowMaximized(window) ? ui::SHOW_STATE_NORMAL : ui::SHOW_STATE_MAXIMIZED); } @@ -208,8 +208,10 @@ bool ToplevelWindowEventFilter::HandleDrag(aura::Window* target, return false; // Only a normal/default window can be moved/resized. - if (target->GetIntProperty(aura::kShowStateKey) != ui::SHOW_STATE_NORMAL && - target->GetIntProperty(aura::kShowStateKey) != ui::SHOW_STATE_DEFAULT) + if (target->GetIntProperty(aura::client::kShowStateKey) != + ui::SHOW_STATE_NORMAL && + target->GetIntProperty(aura::client::kShowStateKey) != + ui::SHOW_STATE_DEFAULT) return false; // Dragging a window moves the local coordinate frame, so do arithmetic diff --git a/ui/aura_shell/window_util.cc b/ui/aura_shell/window_util.cc index d9b40b9..e3ecf9f 100644 --- a/ui/aura_shell/window_util.cc +++ b/ui/aura_shell/window_util.cc @@ -16,7 +16,7 @@ namespace aura_shell { bool IsWindowMaximized(aura::Window* window) { - return window->GetIntProperty(aura::kShowStateKey) == + return window->GetIntProperty(aura::client::kShowStateKey) == ui::SHOW_STATE_MAXIMIZED; } @@ -41,10 +41,10 @@ aura::Window* GetActivatableWindow(aura::Window* window) { } void UpdateBoundsFromShowState(aura::Window* window) { - switch (window->GetIntProperty(aura::kShowStateKey)) { + switch (window->GetIntProperty(aura::client::kShowStateKey)) { case ui::SHOW_STATE_NORMAL: { const gfx::Rect* restore = GetRestoreBounds(window); - window->SetProperty(aura::kRestoreBoundsKey, NULL); + window->SetProperty(aura::client::kRestoreBoundsKey, NULL); if (restore) window->SetBounds(*restore); delete restore; diff --git a/ui/aura_shell/window_util.h b/ui/aura_shell/window_util.h index bfe987e..2327b83 100644 --- a/ui/aura_shell/window_util.h +++ b/ui/aura_shell/window_util.h @@ -19,7 +19,7 @@ namespace aura_shell { // Returns true if |window| is in the maximized state. AURA_SHELL_EXPORT bool IsWindowMaximized(aura::Window* window); -// Convenience setters/getters for |aura::kRootWindowActiveWindow|. +// Convenience setters/getters for |aura::client::kRootWindowActiveWindow|. AURA_SHELL_EXPORT void ActivateWindow(aura::Window* window); AURA_SHELL_EXPORT void DeactivateWindow(aura::Window* window); AURA_SHELL_EXPORT bool IsActiveWindow(aura::Window* window); diff --git a/ui/aura_shell/workspace/workspace.cc b/ui/aura_shell/workspace/workspace.cc index be969b8..a705936 100644 --- a/ui/aura_shell/workspace/workspace.cc +++ b/ui/aura_shell/workspace/workspace.cc @@ -225,7 +225,8 @@ bool Workspace::ContainsFullscreenWindow() const { ++i) { aura::Window* w = *i; if (w->IsVisible() && - w->GetIntProperty(aura::kShowStateKey) == ui::SHOW_STATE_FULLSCREEN) + w->GetIntProperty(aura::client::kShowStateKey) == + ui::SHOW_STATE_FULLSCREEN) return true; } return false; diff --git a/ui/aura_shell/workspace/workspace_manager_unittest.cc b/ui/aura_shell/workspace/workspace_manager_unittest.cc index 0a78250..843e059 100644 --- a/ui/aura_shell/workspace/workspace_manager_unittest.cc +++ b/ui/aura_shell/workspace/workspace_manager_unittest.cc @@ -550,13 +550,13 @@ TEST_F(WorkspaceTest, ContainsFullscreenWindow) { EXPECT_FALSE(ws->ContainsFullscreenWindow()); - w1->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); + w1->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); EXPECT_TRUE(ws->ContainsFullscreenWindow()); - w1->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + w1->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_FALSE(ws->ContainsFullscreenWindow()); - w2->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); + w2->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); EXPECT_TRUE(ws->ContainsFullscreenWindow()); w2->Hide(); diff --git a/ui/aura_shell/workspace_controller.cc b/ui/aura_shell/workspace_controller.cc index 39dbaf1..d7ef302 100644 --- a/ui/aura_shell/workspace_controller.cc +++ b/ui/aura_shell/workspace_controller.cc @@ -4,6 +4,7 @@ #include "ui/aura_shell/workspace_controller.h" +#include "ui/aura/client/activation_client.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" @@ -58,7 +59,7 @@ void WorkspaceController::OnRootWindowResized(const gfx::Size& new_size) { void WorkspaceController::OnWindowPropertyChanged(aura::Window* window, const char* key, void* old) { - if (key == aura::kRootWindowActiveWindow) { + if (key == aura::client::kRootWindowActiveWindow) { // FindBy handles NULL. Workspace* workspace = workspace_manager_->FindBy(GetActiveWindow()); if (workspace) diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 1355f17..620a08c 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -9,11 +9,11 @@ #include "ui/aura/client/activation_client.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/drag_drop_client.h" +#include "ui/aura/client/window_types.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" -#include "ui/aura/window_types.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/canvas.h" @@ -41,22 +41,23 @@ namespace views { namespace { -aura::WindowType GetAuraWindowTypeForWidgetType(Widget::InitParams::Type type) { +aura::client::WindowType GetAuraWindowTypeForWidgetType( + Widget::InitParams::Type type) { switch (type) { case Widget::InitParams::TYPE_WINDOW: - return aura::WINDOW_TYPE_NORMAL; + return aura::client::WINDOW_TYPE_NORMAL; case Widget::InitParams::TYPE_WINDOW_FRAMELESS: case Widget::InitParams::TYPE_CONTROL: case Widget::InitParams::TYPE_POPUP: case Widget::InitParams::TYPE_BUBBLE: - return aura::WINDOW_TYPE_POPUP; + return aura::client::WINDOW_TYPE_POPUP; case Widget::InitParams::TYPE_MENU: - return aura::WINDOW_TYPE_MENU; + return aura::client::WINDOW_TYPE_MENU; case Widget::InitParams::TYPE_TOOLTIP: - return aura::WINDOW_TYPE_TOOLTIP; + return aura::client::WINDOW_TYPE_TOOLTIP; default: NOTREACHED() << "Unhandled widget type " << type; - return aura::WINDOW_TYPE_UNKNOWN; + return aura::client::WINDOW_TYPE_UNKNOWN; } } @@ -105,7 +106,7 @@ class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver { virtual void OnWindowPropertyChanged(aura::Window* window, const char* key, void* old) OVERRIDE { - if (key != aura::kRootWindowActiveWindow) + if (key != aura::client::kRootWindowActiveWindow) return; aura::Window* active = aura::client::GetActivationClient()->GetActiveWindow(); @@ -166,7 +167,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { params.child ? Widget::InitParams::TYPE_CONTROL : params.type; window_->SetType(GetAuraWindowTypeForWidgetType(window_type)); // TODO(jamescook): Should this use params.show_state instead? - window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + window_->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); window_->Init(params.create_texture_for_layer ? ui::Layer::LAYER_HAS_TEXTURE : ui::Layer::LAYER_HAS_NO_TEXTURE); @@ -333,7 +334,7 @@ void NativeWidgetAura::GetWindowPlacement( // The interface specifies returning restored bounds, not current bounds. *bounds = GetRestoredBounds(); *show_state = static_cast<ui::WindowShowState>( - window_->GetIntProperty(aura::kShowStateKey)); + window_->GetIntProperty(aura::client::kShowStateKey)); } void NativeWidgetAura::SetWindowTitle(const string16& title) { @@ -361,7 +362,7 @@ void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { } void NativeWidgetAura::BecomeModal() { - window_->SetIntProperty(aura::kModalKey, 1); + window_->SetIntProperty(aura::client::kModalKey, 1); } gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { @@ -375,7 +376,7 @@ gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { gfx::Rect NativeWidgetAura::GetRestoredBounds() const { gfx::Rect* restore_bounds = reinterpret_cast<gfx::Rect*>( - window_->GetProperty(aura::kRestoreBoundsKey)); + window_->GetProperty(aura::client::kRestoreBoundsKey)); return restore_bounds ? *restore_bounds : window_->bounds(); } @@ -408,7 +409,7 @@ void NativeWidgetAura::Close() { ownership_ == Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); if (window_) { Hide(); - window_->SetIntProperty(aura::kModalKey, 0); + window_->SetIntProperty(aura::client::kModalKey, 0); } if (!close_widget_factory_.HasWeakPtrs()) { @@ -440,7 +441,7 @@ void NativeWidgetAura::ShowMaximizedWithBounds( void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN) { - window_->SetIntProperty(aura::kShowStateKey, state); + window_->SetIntProperty(aura::client::kShowStateKey, state); } window_->Show(); if (can_activate_ && (state != ui::SHOW_STATE_INACTIVE || @@ -466,11 +467,12 @@ bool NativeWidgetAura::IsActive() const { } void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { - window_->SetIntProperty(aura::kAlwaysOnTopKey, on_top); + window_->SetIntProperty(aura::client::kAlwaysOnTopKey, on_top); } void NativeWidgetAura::Maximize() { - window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); + window_->SetIntProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_MAXIMIZED); } void NativeWidgetAura::Minimize() { @@ -479,27 +481,27 @@ void NativeWidgetAura::Minimize() { } bool NativeWidgetAura::IsMaximized() const { - return window_->GetIntProperty(aura::kShowStateKey) == + return window_->GetIntProperty(aura::client::kShowStateKey) == ui::SHOW_STATE_MAXIMIZED; } bool NativeWidgetAura::IsMinimized() const { - return window_->GetIntProperty(aura::kShowStateKey) == + return window_->GetIntProperty(aura::client::kShowStateKey) == ui::SHOW_STATE_MINIMIZED; } void NativeWidgetAura::Restore() { - window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL); + window_->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); } void NativeWidgetAura::SetFullscreen(bool fullscreen) { window_->SetIntProperty( - aura::kShowStateKey, + aura::client::kShowStateKey, fullscreen ? ui::SHOW_STATE_FULLSCREEN : ui::SHOW_STATE_NORMAL); } bool NativeWidgetAura::IsFullscreen() const { - return window_->GetIntProperty(aura::kShowStateKey) == + return window_->GetIntProperty(aura::client::kShowStateKey) == ui::SHOW_STATE_FULLSCREEN; } diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index b1246fe..efddcfe 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/logging.h" -#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/tooltip_client.h" #include "ui/aura/root_window.h" #include "ui/base/resource/resource_bundle.h" |