summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorstevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 13:24:13 +0000
committerstevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-11 13:24:13 +0000
commit7d56f819d0d4c20c9448c68c8e251e06e010376e (patch)
tree8765b1a12525c75b1e085105493c6db9509e6d74 /ash
parente92742011debdfab91e2622816aa5f91ff777177 (diff)
downloadchromium_src-7d56f819d0d4c20c9448c68c8e251e06e010376e.zip
chromium_src-7d56f819d0d4c20c9448c68c8e251e06e010376e.tar.gz
chromium_src-7d56f819d0d4c20c9448c68c8e251e06e010376e.tar.bz2
Revert 222512 "Group WM related properties to ash::wm::WindowSet..."
> Group WM related properties to ash::wm::WindowSettings > * Introduced Observer to observe changes to the settings. > * renamed UserHasChangedWindowPositinoOrSize to bounds_channed_by_user > > BUG=272460 > > Review URL: https://chromiumcodereview.appspot.com/23518006 REASON FOR REVERT: - Causing compiler errors on the tree: Win Aura Builder http://build.chromium.org/p/chromium.win/buildstatus?builder=Win%20Aura%20Builder&number=11959 TBR=oshima@chromium.org Review URL: https://codereview.chromium.org/23478025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp2
-rw-r--r--ash/wm/base_layout_manager.cc23
-rw-r--r--ash/wm/base_layout_manager.h16
-rw-r--r--ash/wm/dock/docked_window_layout_manager_unittest.cc6
-rw-r--r--ash/wm/dock/docked_window_resizer.cc37
-rw-r--r--ash/wm/dock/docked_window_resizer_unittest.cc8
-rw-r--r--ash/wm/frame_painter.cc28
-rw-r--r--ash/wm/frame_painter.h8
-rw-r--r--ash/wm/frame_painter_unittest.cc6
-rw-r--r--ash/wm/panels/panel_layout_manager.cc4
-rw-r--r--ash/wm/panels/panel_window_resizer.cc13
-rw-r--r--ash/wm/panels/panel_window_resizer_unittest.cc28
-rw-r--r--ash/wm/property_util.cc16
-rw-r--r--ash/wm/property_util.h13
-rw-r--r--ash/wm/stacking_controller.cc8
-rw-r--r--ash/wm/toplevel_window_event_handler.cc7
-rw-r--r--ash/wm/window_properties.cc8
-rw-r--r--ash/wm/window_properties.h26
-rw-r--r--ash/wm/window_settings.cc63
-rw-r--r--ash/wm/window_settings.h107
-rw-r--r--ash/wm/window_util.cc18
-rw-r--r--ash/wm/window_util.h13
-rw-r--r--ash/wm/workspace/auto_window_management.cc24
-rw-r--r--ash/wm/workspace/colored_window_controller.cc4
-rw-r--r--ash/wm/workspace/frame_caption_button_container_view.cc5
-rw-r--r--ash/wm/workspace/frame_maximize_button.cc19
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc20
-rw-r--r--ash/wm/workspace/workspace_layout_manager.h4
-rw-r--r--ash/wm/workspace/workspace_layout_manager_unittest.cc3
-rw-r--r--ash/wm/workspace/workspace_window_resizer.cc15
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc7
-rw-r--r--ash/wm/workspace_controller.cc4
-rw-r--r--ash/wm/workspace_controller_unittest.cc80
33 files changed, 271 insertions, 372 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 3185ee0..d7104d2 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -493,8 +493,6 @@
'wm/window_cycle_controller.h',
'wm/window_cycle_list.cc',
'wm/window_cycle_list.h',
- 'wm/window_settings.cc',
- 'wm/window_settings.h',
'wm/window_properties.cc',
'wm/window_properties.h',
'wm/window_resizer.cc',
diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc
index 236fb00..f22b07e 100644
--- a/ash/wm/base_layout_manager.cc
+++ b/ash/wm/base_layout_manager.cc
@@ -10,7 +10,6 @@
#include "ash/shell.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
-#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/workspace_window_resizer.h"
#include "ui/aura/client/activation_client.h"
@@ -61,7 +60,7 @@ gfx::Rect BaseLayoutManager::BoundsWithScreenEdgeVisible(
}
/////////////////////////////////////////////////////////////////////////////
-// BaseLayoutManager, aura::LayoutManager overrides:
+// BaseLayoutManager, LayoutManager overrides:
void BaseLayoutManager::OnWindowResized() {
}
@@ -69,7 +68,6 @@ void BaseLayoutManager::OnWindowResized() {
void BaseLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
windows_.insert(child);
child->AddObserver(this);
- wm::GetWindowSettings(child)->AddObserver(this);
// Only update the bounds if the window has a show state that depends on the
// workspace area.
if (wm::IsWindowMaximized(child) || wm::IsWindowFullscreen(child))
@@ -79,7 +77,6 @@ void BaseLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
void BaseLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
windows_.erase(child);
child->RemoveObserver(this);
- wm::GetWindowSettings(child)->RemoveObserver(this);
}
void BaseLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
@@ -107,7 +104,15 @@ void BaseLayoutManager::SetChildBounds(aura::Window* child,
}
/////////////////////////////////////////////////////////////////////////////
-// BaseLayoutManager, aura::WindowObserver overrides:
+// BaseLayoutManager, ash::ShellObserver overrides:
+
+void BaseLayoutManager::OnDisplayWorkAreaInsetsChanged() {
+ AdjustAllWindowsBoundsForWorkAreaChange(
+ ADJUST_WINDOW_WORK_AREA_INSETS_CHANGED);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// BaseLayoutManager, WindowObserver overrides:
void BaseLayoutManager::OnWindowPropertyChanged(aura::Window* window,
const void* key,
@@ -156,14 +161,6 @@ void BaseLayoutManager::OnWindowActivated(aura::Window* gained_active,
}
}
-/////////////////////////////////////////////////////////////////////////////
-// BaseLayoutManager, ash::ShellObserver overrides:
-
-void BaseLayoutManager::OnDisplayWorkAreaInsetsChanged() {
- AdjustAllWindowsBoundsForWorkAreaChange(
- ADJUST_WINDOW_WORK_AREA_INSETS_CHANGED);
-}
-
//////////////////////////////////////////////////////////////////////////////
// BaseLayoutManager, protected:
diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h
index c9e49e3..0fc2b36 100644
--- a/ash/wm/base_layout_manager.h
+++ b/ash/wm/base_layout_manager.h
@@ -9,7 +9,6 @@
#include "ash/ash_export.h"
#include "ash/shell_observer.h"
-#include "ash/wm/window_settings.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/client/activation_change_observer.h"
@@ -33,10 +32,9 @@ namespace internal {
// properly.
class ASH_EXPORT BaseLayoutManager
: public aura::LayoutManager,
+ public ash::ShellObserver,
public aura::WindowObserver,
- public aura::client::ActivationChangeObserver,
- public ShellObserver,
- public wm::WindowSettings::Observer {
+ public aura::client::ActivationChangeObserver {
public:
typedef std::set<aura::Window*> WindowSet;
@@ -51,7 +49,7 @@ class ASH_EXPORT BaseLayoutManager
static gfx::Rect BoundsWithScreenEdgeVisible(aura::Window* window,
const gfx::Rect& restore_bounds);
- // aura::LayoutManager overrides:
+ // LayoutManager overrides:
virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
@@ -61,7 +59,10 @@ class ASH_EXPORT BaseLayoutManager
virtual void SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) OVERRIDE;
- // aura::WindowObserver overrides:
+ // ash::ShellObserver overrides:
+ virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE;
+
+ // WindowObserver overrides:
virtual void OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) OVERRIDE;
@@ -74,9 +75,6 @@ class ASH_EXPORT BaseLayoutManager
virtual void OnWindowActivated(aura::Window* gained_active,
aura::Window* lost_active) OVERRIDE;
- // ash::ShellObserver overrides:
- virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE;
-
protected:
enum AdjustWindowReason {
ADJUST_WINDOW_DISPLAY_SIZE_CHANGED,
diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc
index a29f7a3..b2f6ffd 100644
--- a/ash/wm/dock/docked_window_layout_manager_unittest.cc
+++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc
@@ -20,8 +20,8 @@
#include "ash/test/shell_test_api.h"
#include "ash/test/test_launcher_delegate.h"
#include "ash/wm/panels/panel_layout_manager.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_resizer.h"
-#include "ash/wm/window_settings.h"
#include "base/basictypes.h"
#include "base/command_line.h"
#include "ui/aura/client/aura_constants.h"
@@ -176,7 +176,7 @@ class DockedWindowLayoutManagerTest
if (window_type_ == aura::client::WINDOW_TYPE_PANEL) {
ASSERT_NO_FATAL_FAILURE(DragStart(window));
- EXPECT_TRUE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
// Drag enough to detach since our tests assume panels to be initially
// detached.
@@ -188,7 +188,7 @@ class DockedWindowLayoutManagerTest
// The panel should be detached when the drag completes.
DragEnd();
- EXPECT_FALSE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
EXPECT_EQ(root_window, window->GetRootWindow());
diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc
index b356175..bf07d22 100644
--- a/ash/wm/dock/docked_window_resizer.cc
+++ b/ash/wm/dock/docked_window_resizer.cc
@@ -15,7 +15,7 @@
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/dock/docked_window_layout_manager.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/workspace/magnetism_matcher.h"
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/workspace_window_resizer.h"
@@ -76,10 +76,9 @@ void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) {
// Temporarily clear kWindowTrackedByWorkspaceKey for windows that are snapped
// to screen edges e.g. when they are docked. This prevents the windows from
// getting snapped to other nearby windows during the drag.
- wm::WindowSettings* window_settings = wm::GetWindowSettings(GetTarget());
- bool was_tracked_by_workspace = window_settings->tracked_by_workspace();
+ bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget());
if (set_tracked_by_workspace)
- window_settings->SetTrackedByWorkspace(false);
+ SetTrackedByWorkspace(GetTarget(), false);
gfx::Point modified_location(location.x() + offset.x(),
location.y() + offset.y());
@@ -87,7 +86,9 @@ void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) {
next_window_resizer_->Drag(modified_location, event_flags);
if (!resizer)
return;
- window_settings->SetTrackedByWorkspace(was_tracked_by_workspace);
+
+ if (set_tracked_by_workspace)
+ SetTrackedByWorkspace(GetTarget(), tracked_by_workspace);
DockedWindowLayoutManager* new_dock_layout =
GetDockedLayoutManagerAtPoint(last_location_);
@@ -135,14 +136,15 @@ void DockedWindowResizer::CompleteDrag(int event_flags) {
// Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they
// don't get forced into the workspace that may be shrunken because of docked
// windows.
- wm::WindowSettings* window_settings = wm::GetWindowSettings(GetTarget());
- bool was_tracked_by_workspace = window_settings->tracked_by_workspace();
- if (was_docked_)
- window_settings->SetTrackedByWorkspace(false);
+ bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget());
+ bool set_tracked_by_workspace = was_docked_;
+ if (set_tracked_by_workspace)
+ SetTrackedByWorkspace(GetTarget(), false);
// The root window can change when dragging into a different screen.
next_window_resizer_->CompleteDrag(event_flags);
FinishedDragging();
- window_settings->SetTrackedByWorkspace(was_tracked_by_workspace);
+ if (set_tracked_by_workspace)
+ SetTrackedByWorkspace(GetTarget(), tracked_by_workspace);
}
void DockedWindowResizer::RevertDrag() {
@@ -151,13 +153,14 @@ void DockedWindowResizer::RevertDrag() {
// Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they
// don't get forced into the workspace that may be shrunken because of docked
// windows.
- wm::WindowSettings* window_settings = wm::GetWindowSettings(GetTarget());
- bool was_tracked_by_workspace = window_settings->tracked_by_workspace();
- if (was_docked_)
- window_settings->SetTrackedByWorkspace(false);
+ bool tracked_by_workspace = GetTrackedByWorkspace(GetTarget());
+ bool set_tracked_by_workspace = was_docked_;
+ if (set_tracked_by_workspace)
+ SetTrackedByWorkspace(GetTarget(), false);
next_window_resizer_->RevertDrag();
FinishedDragging();
- window_settings->SetTrackedByWorkspace(was_tracked_by_workspace);
+ if (set_tracked_by_workspace)
+ SetTrackedByWorkspace(GetTarget(), tracked_by_workspace);
}
aura::Window* DockedWindowResizer::GetTarget() {
@@ -276,7 +279,7 @@ void DockedWindowResizer::StartedDragging() {
if (GetTarget()->type() != aura::client::WINDOW_TYPE_PANEL &&
GetTarget()->parent()->id() == kShellWindowId_DefaultContainer) {
// The window is going to be reparented - avoid completing the drag.
- wm::GetWindowSettings(GetTarget())->set_continue_drag_after_reparent(true);
+ GetTarget()->SetProperty(kContinueDragAfterReparent, true);
// Reparent the window into the docked windows container in order to get it
// on top of other docked windows.
@@ -297,7 +300,7 @@ void DockedWindowResizer::FinishedDragging() {
bool should_dock = was_docked_;
const bool attached_panel =
window->type() == aura::client::WINDOW_TYPE_PANEL &&
- wm::GetWindowSettings(window)->panel_attached();
+ window->GetProperty(kPanelAttachedKey);
// If a window was previously docked then keep it docked if it is resized and
// still aligned at the screen edge.
if ((was_docked_ ||
diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc
index 5d6566e..49aeca2 100644
--- a/ash/wm/dock/docked_window_resizer_unittest.cc
+++ b/ash/wm/dock/docked_window_resizer_unittest.cc
@@ -21,7 +21,7 @@
#include "ash/wm/dock/docked_window_layout_manager.h"
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/panels/panel_layout_manager.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/aura/client/aura_constants.h"
@@ -185,7 +185,7 @@ class DockedWindowResizerTest
if (window_type_ == aura::client::WINDOW_TYPE_PANEL) {
ASSERT_NO_FATAL_FAILURE(DragStart(window));
- EXPECT_TRUE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
// Drag enough to detach since our tests assume panels to be initially
// detached.
@@ -197,7 +197,7 @@ class DockedWindowResizerTest
// The panel should be detached when the drag completes.
DragEnd();
- EXPECT_FALSE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
EXPECT_EQ(root_window, window->GetRootWindow());
@@ -1040,7 +1040,7 @@ TEST_P(DockedWindowResizerTest, DragToShelf)
if (test_panels()) {
// The panel should be touching the shelf and attached.
EXPECT_EQ(shelf_y, w1->bounds().bottom());
- EXPECT_TRUE(wm::GetWindowSettings(w1.get())->panel_attached());
+ EXPECT_TRUE(w1->GetProperty(kPanelAttachedKey));
} else {
// The window should not be touching the shelf.
EXPECT_EQ(shelf_y - kDistanceFromShelf, w1->bounds().bottom());
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 3b723f50..29865e1 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -12,7 +12,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "base/logging.h" // DCHECK
@@ -273,7 +273,6 @@ void FramePainter::Init(
// itself in OnWindowDestroying() below, or in the destructor if we go away
// before the window.
window_->AddObserver(this);
- wm::GetWindowSettings(window_)->AddObserver(this);
// Solo-window header updates are handled by the workspace controller when
// this window is added to the desktop.
@@ -391,9 +390,9 @@ bool FramePainter::ShouldUseMinimalHeaderStyle(Themed header_themed) const {
// - If the user has installed a theme with custom images for the header.
// - For windows which are not tracked by the workspace code (which are used
// for tab dragging).
- return (frame_->IsMaximized() || frame_->IsFullscreen()) &&
+ return ((frame_->IsMaximized() || frame_->IsFullscreen()) &&
header_themed == THEMED_NO &&
- wm::GetWindowSettings(frame_->GetNativeWindow())->tracked_by_workspace();
+ GetTrackedByWorkspace(frame_->GetNativeWindow()));
}
void FramePainter::PaintHeader(views::NonClientFrameView* view,
@@ -618,21 +617,19 @@ void FramePainter::OnThemeChanged() {
}
///////////////////////////////////////////////////////////////////////////////
-// WindowSettings::jObserver overrides:
-void FramePainter::OnTrackedByWorkspaceChanged(aura::Window* window,
- bool old) {
- // When 'TrackedByWorkspace' changes, we are going to paint the header
- // differently. Schedule a paint to ensure everything is updated correctly.
- if (wm::GetWindowSettings(window)->tracked_by_workspace())
- frame_->non_client_view()->SchedulePaint();
-}
-
-///////////////////////////////////////////////////////////////////////////////
// aura::WindowObserver overrides:
void FramePainter::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) {
+ // When 'kWindowTrackedByWorkspaceKey' changes, we are going to paint the
+ // header differently. Schedule a paint to ensure everything is updated
+ // correctly.
+ if (key == internal::kWindowTrackedByWorkspaceKey &&
+ GetTrackedByWorkspace(window)) {
+ frame_->non_client_view()->SchedulePaint();
+ }
+
if (key != aura::client::kShowStateKey)
return;
@@ -666,7 +663,6 @@ void FramePainter::OnWindowDestroying(aura::Window* destroying) {
// Must be removed here and not in the destructor, as the aura::Window is
// already destroyed when our destructor runs.
window_->RemoveObserver(this);
- wm::GetWindowSettings(window_)->RemoveObserver(this);
// If we have two or more windows open and we close this one, we might trigger
// the solo window appearance for another window.
@@ -726,7 +722,7 @@ int FramePainter::GetHeaderCornerRadius() const {
// tracked by the workspace code. (Windows which are not tracked by the
// workspace code are used for tab dragging.)
bool square_corners = ((frame_->IsMaximized() || frame_->IsFullscreen())) &&
- wm::GetWindowSettings(frame_->GetNativeWindow())->tracked_by_workspace();
+ GetTrackedByWorkspace(frame_->GetNativeWindow());
const int kCornerRadius = 2;
return square_corners ? 0 : kCornerRadius;
}
diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h
index a5d40fb..4a9e968 100644
--- a/ash/wm/frame_painter.h
+++ b/ash/wm/frame_painter.h
@@ -6,7 +6,6 @@
#define ASH_WM_FRAME_PAINTER_H_
#include "ash/ash_export.h"
-#include "ash/wm/window_settings.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h" // OVERRIDE
#include "base/gtest_prod_util.h"
@@ -42,8 +41,7 @@ class FrameCaptionButtonContainerView;
// various implementations of views::NonClientFrameView. Canonical source of
// layout constants for Ash window frames.
class ASH_EXPORT FramePainter : public aura::WindowObserver,
- public ui::AnimationDelegate,
- public wm::WindowSettings::Observer {
+ public ui::AnimationDelegate {
public:
// Opacity values for the window header in various states, from 0 to 255.
static int kActiveWindowOpacity;
@@ -147,10 +145,6 @@ class ASH_EXPORT FramePainter : public aura::WindowObserver,
virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE;
virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE;
- // ash::WindowSettings::Observer overrides:
- virtual void OnTrackedByWorkspaceChanged(aura::Window* window,
- bool old) OVERRIDE;
-
// Overridden from ui::AnimationDelegate
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc
index 1bc6923..f412afd 100644
--- a/ash/wm/frame_painter_unittest.cc
+++ b/ash/wm/frame_painter_unittest.cc
@@ -9,7 +9,7 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/property_util.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "base/memory/scoped_ptr.h"
@@ -567,9 +567,9 @@ TEST_F(FramePainterTest, MinimalHeaderStyle) {
// style.
EXPECT_FALSE(p->ShouldUseMinimalHeaderStyle(FramePainter::THEMED_YES));
- wm::GetWindowSettings(w->GetNativeWindow())->SetTrackedByWorkspace(false);
+ SetTrackedByWorkspace(w->GetNativeWindow(), false);
EXPECT_FALSE(p->ShouldUseMinimalHeaderStyle(FramePainter::THEMED_NO));
- wm::GetWindowSettings(w->GetNativeWindow())->SetTrackedByWorkspace(true);
+ SetTrackedByWorkspace(w->GetNativeWindow(), true);
}
// Ensure the title text is vertically aligned with the window icon.
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index 65f15e6..2b00c88 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -17,7 +17,7 @@
#include "ash/wm/frame_painter.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/auto_reset.h"
#include "base/bind.h"
@@ -342,7 +342,7 @@ void PanelLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
if (in_add_window_)
return;
base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true);
- if (!wm::GetWindowSettings(child)->panel_attached()) {
+ if (!child->GetProperty(kPanelAttachedKey)) {
// This should only happen when a window is added to panel container as a
// result of bounds change from within the application during a drag.
// If so we have already stopped the drag and should reparent the panel
diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc
index 606a7e8..67e4bd1 100644
--- a/ash/wm/panels/panel_window_resizer.cc
+++ b/ash/wm/panels/panel_window_resizer.cc
@@ -14,7 +14,7 @@
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/panels/panel_layout_manager.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "base/memory/weak_ptr.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
@@ -130,7 +130,7 @@ PanelWindowResizer::PanelWindowResizer(WindowResizer* next_window_resizer,
panel_container_(NULL),
initial_panel_container_(NULL),
did_move_or_resize_(false),
- was_attached_(wm::GetWindowSettings(GetTarget())->panel_attached()),
+ was_attached_(GetTarget()->GetProperty(internal::kPanelAttachedKey)),
should_attach_(was_attached_),
weak_ptr_factory_(this) {
DCHECK(details_.is_resizable);
@@ -191,8 +191,8 @@ void PanelWindowResizer::StartedDragging() {
GetPanelLayoutManager(panel_container_)->StartDragging(GetTarget());
if (!was_attached_) {
// Attach the panel while dragging placing it in front of other panels.
- wm::GetWindowSettings(GetTarget())->set_continue_drag_after_reparent(true);
- wm::GetWindowSettings(GetTarget())->set_panel_attached(true);
+ GetTarget()->SetProperty(internal::kContinueDragAfterReparent, true);
+ GetTarget()->SetProperty(internal::kPanelAttachedKey, true);
// We use root window coordinates to ensure that during the drag the panel
// is reparented to a container in the root window that has that window.
GetTarget()->SetDefaultParentByRootWindow(
@@ -204,8 +204,9 @@ void PanelWindowResizer::StartedDragging() {
void PanelWindowResizer::FinishDragging() {
if (!did_move_or_resize_)
return;
- if (wm::GetWindowSettings(GetTarget())->panel_attached() != should_attach_) {
- wm::GetWindowSettings(GetTarget())->set_panel_attached(should_attach_);
+ if (GetTarget()->GetProperty(internal::kPanelAttachedKey) !=
+ should_attach_) {
+ GetTarget()->SetProperty(internal::kPanelAttachedKey, should_attach_);
// We use last known location to ensure that after the drag the panel
// is reparented to a container in the root window that has that location.
GetTarget()->SetDefaultParentByRootWindow(
diff --git a/ash/wm/panels/panel_window_resizer_unittest.cc b/ash/wm/panels/panel_window_resizer_unittest.cc
index 81bff9c..1f1bdf5 100644
--- a/ash/wm/panels/panel_window_resizer_unittest.cc
+++ b/ash/wm/panels/panel_window_resizer_unittest.cc
@@ -18,7 +18,7 @@
#include "ash/test/test_launcher_delegate.h"
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/panels/panel_layout_manager.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/base/hit_test.h"
@@ -98,7 +98,7 @@ class PanelWindowResizerTest : public test::AshTestBase {
// Test dragging the panel slightly, then detaching, and then reattaching
// dragging out by the vector (dx, dy).
void DetachReattachTest(aura::Window* window, int dx, int dy) {
- EXPECT_TRUE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
aura::RootWindow* root_window = window->GetRootWindow();
EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
DragStart(window);
@@ -118,7 +118,7 @@ class PanelWindowResizerTest : public test::AshTestBase {
// The panel should be detached when the drag completes.
DragEnd();
- EXPECT_FALSE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
EXPECT_EQ(root_window, window->GetRootWindow());
@@ -130,7 +130,7 @@ class PanelWindowResizerTest : public test::AshTestBase {
DragEnd();
// The panel should be reattached and have snapped to the launcher.
- EXPECT_TRUE(wm::GetWindowSettings(window)->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y());
EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
@@ -290,7 +290,7 @@ TEST_F(PanelWindowResizerTest, DetachThenDragAcrossDisplays) {
EXPECT_EQ(root_windows[0], window->GetRootWindow());
EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
- EXPECT_FALSE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
@@ -300,7 +300,7 @@ TEST_F(PanelWindowResizerTest, DetachThenDragAcrossDisplays) {
EXPECT_EQ(root_windows[1], window->GetRootWindow());
EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
- EXPECT_FALSE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
}
@@ -321,7 +321,7 @@ TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) {
EXPECT_EQ(root_windows[1], window->GetRootWindow());
EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
- EXPECT_FALSE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
}
@@ -342,7 +342,7 @@ TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) {
DragMove(0, -100);
DragEnd();
EXPECT_EQ(root_windows[0], window->GetRootWindow());
- EXPECT_FALSE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
// Drag the window just above the other display's launcher.
DragStart(window.get());
@@ -355,7 +355,7 @@ TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) {
// When dropped should move to second display's panel container.
EXPECT_EQ(root_windows[1], window->GetRootWindow());
- EXPECT_TRUE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
}
@@ -381,26 +381,26 @@ TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) {
// When dropped should move to second display's panel container.
EXPECT_EQ(root_windows[1], window->GetRootWindow());
- EXPECT_TRUE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
}
TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) {
scoped_ptr<aura::Window> window(
CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
- EXPECT_TRUE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
DragStart(window.get());
DragMove(0, -100);
DragRevert();
- EXPECT_TRUE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
// Detach panel.
DragStart(window.get());
DragMove(0, -100);
DragEnd();
- EXPECT_FALSE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
@@ -410,7 +410,7 @@ TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) {
// When the drag is reverted it should remain detached.
DragRevert();
- EXPECT_FALSE(wm::GetWindowSettings(window.get())->panel_attached());
+ EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
EXPECT_EQ(internal::kShellWindowId_DefaultContainer,
window->parent()->id());
}
diff --git a/ash/wm/property_util.cc b/ash/wm/property_util.cc
index f78eebd..5aac996 100644
--- a/ash/wm/property_util.cc
+++ b/ash/wm/property_util.cc
@@ -37,6 +37,22 @@ void ClearRestoreBounds(aura::Window* window) {
window->ClearProperty(aura::client::kRestoreBoundsKey);
}
+void SetTrackedByWorkspace(aura::Window* window, bool value) {
+ window->SetProperty(internal::kWindowTrackedByWorkspaceKey, value);
+}
+
+bool GetTrackedByWorkspace(const aura::Window* window) {
+ return window->GetProperty(internal::kWindowTrackedByWorkspaceKey);
+}
+
+void SetIgnoredByShelf(aura::Window* window, bool value) {
+ window->SetProperty(internal::kIgnoredByShelfKey, value);
+}
+
+bool GetIgnoredByShelf(const aura::Window* window) {
+ return window->GetProperty(internal::kIgnoredByShelfKey);
+}
+
void SetWindowAlwaysRestoresToRestoreBounds(aura::Window* window, bool value) {
window->SetProperty(internal::kWindowRestoresToRestoreBounds, value);
}
diff --git a/ash/wm/property_util.h b/ash/wm/property_util.h
index 6a0d89a..365a373e 100644
--- a/ash/wm/property_util.h
+++ b/ash/wm/property_util.h
@@ -37,6 +37,11 @@ ASH_EXPORT gfx::Rect GetRestoreBoundsInParent(aura::Window* window);
// Deletes and clears the restore bounds property on |window|.
ASH_EXPORT void ClearRestoreBounds(aura::Window* window);
+// Sets whether |window| is ignored when determining whether the shelf should
+// be darkened when overlapped.
+ASH_EXPORT void SetIgnoredByShelf(aura::Window* window, bool value);
+ASH_EXPORT bool GetIgnoredByShelf(const aura::Window* window);
+
// Sets whether |window| should always be restored to the restore bounds
// (sometimes the workspace layout manager restores the window to its original
// bounds instead of the restore bounds. Setting this key overrides that
@@ -46,6 +51,14 @@ ASH_EXPORT void SetWindowAlwaysRestoresToRestoreBounds(aura::Window* window,
bool value);
ASH_EXPORT bool GetWindowAlwaysRestoresToRestoreBounds(
const aura::Window* window);
+
+// Sets whether the specified window is tracked by workspace code. Default is
+// true. If set to false the workspace does not switch the current workspace,
+// nor does it attempt to impose constraints on the bounds of the window. This
+// is intended for tab dragging.
+ASH_EXPORT void SetTrackedByWorkspace(aura::Window* window, bool value);
+ASH_EXPORT bool GetTrackedByWorkspace(const aura::Window* window);
+
} // namespace ash
#endif // ASH_WM_PROPERTY_UTIL_H_
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 51e13b3..4476a86 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -10,7 +10,7 @@
#include "ash/shell_window_ids.h"
#include "ash/wm/always_on_top_controller.h"
#include "ash/wm/coordinate_conversion.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -49,6 +49,10 @@ bool HasTransientParentWindow(aura::Window* window) {
window->transient_parent()->type() != aura::client::WINDOW_TYPE_UNKNOWN;
}
+bool IsPanelAttached(aura::Window* window) {
+ return window->GetProperty(internal::kPanelAttachedKey);
+}
+
internal::AlwaysOnTopController*
GetAlwaysOnTopController(aura::RootWindow* root_window) {
return internal::GetRootWindowController(root_window)->
@@ -92,7 +96,7 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* context,
return GetContainerById(
target_root, internal::kShellWindowId_UnparentedControlContainer);
case aura::client::WINDOW_TYPE_PANEL:
- if (wm::GetWindowSettings(window)->panel_attached())
+ if (IsPanelAttached(window))
return GetContainerById(target_root,
internal::kShellWindowId_PanelContainer);
else
diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc
index 8f30b0e..a0d4b5e 100644
--- a/ash/wm/toplevel_window_event_handler.cc
+++ b/ash/wm/toplevel_window_event_handler.cc
@@ -7,8 +7,8 @@
#include "ash/shell.h"
#include "ash/wm/property_util.h"
#include "ash/wm/resize_shadow_controller.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_resizer.h"
-#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "base/message_loop/message_loop.h"
@@ -105,9 +105,8 @@ void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowHierarchyChanging(
if (params.receiver != resizer_->GetTarget())
return;
- if (wm::GetWindowSettings(params.receiver)->continue_drag_after_reparent()) {
- wm::GetWindowSettings(params.receiver)->
- set_continue_drag_after_reparent(false);
+ if (params.receiver->GetProperty(internal::kContinueDragAfterReparent)) {
+ params.receiver->SetProperty(internal::kContinueDragAfterReparent, false);
AddHandlers(params.new_parent);
} else {
handler_->CompleteDrag(DRAG_COMPLETE, 0);
diff --git a/ash/wm/window_properties.cc b/ash/wm/window_properties.cc
index 39291cc..c95cf90 100644
--- a/ash/wm/window_properties.cc
+++ b/ash/wm/window_properties.cc
@@ -4,19 +4,27 @@
#include "ash/wm/window_properties.h"
+#include "ash/root_window_controller.h"
+#include "ash/wm/frame_painter.h"
#include "ui/aura/window_property.h"
#include "ui/gfx/rect.h"
namespace ash {
namespace internal {
DEFINE_WINDOW_PROPERTY_KEY(bool, kAnimateToFullscreenKey, true);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kContinueDragAfterReparent, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kFullscreenUsesMinimalChromeKey, false);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoredByShelfKey, false);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kPanelAttachedKey, true);
DEFINE_WINDOW_PROPERTY_KEY(bool, kStayInSameRootWindowKey, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kUsesScreenCoordinatesKey, false);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kUserChangedWindowPositionOrSizeKey, false);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::Rect,
kPreAutoManagedWindowBoundsKey,
NULL);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kWindowPositionManagedKey, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kWindowRestoresToRestoreBounds, false);
+DEFINE_WINDOW_PROPERTY_KEY(bool, kWindowTrackedByWorkspaceKey, true);
} // namespace internal
} // namespace ash
diff --git a/ash/wm/window_properties.h b/ash/wm/window_properties.h
index 20154da..341d9b8 100644
--- a/ash/wm/window_properties.h
+++ b/ash/wm/window_properties.h
@@ -25,18 +25,35 @@ namespace internal {
// the fullscreen state.
extern const aura::WindowProperty<bool>* const kAnimateToFullscreenKey;
+// A property key to indicate that an in progress drag should be continued
+// after the window is reparented to another container.
+extern const aura::WindowProperty<bool>* const kContinueDragAfterReparent;
+
// A property key to indicate whether there is any chrome at all that cannot be
// hidden when the window is fullscreen. This is unrelated to whether the full
// chrome can be revealed by hovering the mouse at the top of the screen.
ASH_EXPORT extern const aura::WindowProperty<bool>* const
kFullscreenUsesMinimalChromeKey;
+// True if the window is ignored by the shelf layout manager for purposes of
+// darkening the shelf.
+extern const aura::WindowProperty<bool>* const
+ kIgnoredByShelfKey;
+
+// True if this window is an attached panel.
+ASH_EXPORT extern const aura::WindowProperty<bool>* const kPanelAttachedKey;
+
// If this is set to true, the window stays in the same root window
// even if the bounds outside of its root window is set.
// This is exported as it's used in the tests.
ASH_EXPORT extern const aura::WindowProperty<bool>* const
kStayInSameRootWindowKey;
+// A property key to remember if a windows position or size was changed by a
+// user.
+ASH_EXPORT extern const aura::WindowProperty<bool>* const
+ kUserChangedWindowPositionOrSizeKey;
+
// A property to remember the window position which was set before the
// auto window position manager changed the window bounds, so that it can get
// restored when only this one window gets shown.
@@ -46,10 +63,19 @@ ASH_EXPORT extern const aura::WindowProperty<gfx::Rect*>* const
// Property to tell if the container uses the screen coordinates.
extern const aura::WindowProperty<bool>* const kUsesScreenCoordinatesKey;
+// A property key to remember if a windows position can be managed by the
+// workspace manager or not.
+ASH_EXPORT extern const aura::WindowProperty<bool>* const
+ kWindowPositionManagedKey;
+
// A property key to tell the workspace layout manager to always restore the
// window to the restore-bounds (false by default).
extern const aura::WindowProperty<bool>* const kWindowRestoresToRestoreBounds;
+// True if the window is controlled by the workspace manager.
+extern const aura::WindowProperty<bool>* const
+ kWindowTrackedByWorkspaceKey;
+
// Alphabetical sort.
} // namespace internal
diff --git a/ash/wm/window_settings.cc b/ash/wm/window_settings.cc
deleted file mode 100644
index cd62688..0000000
--- a/ash/wm/window_settings.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/wm/window_settings.h"
-
-#include "ui/aura/window.h"
-#include "ui/aura/window_property.h"
-#include "ui/gfx/display.h"
-
-DECLARE_WINDOW_PROPERTY_TYPE(ash::wm::WindowSettings*);
-
-namespace ash {
-namespace wm {
-
-DEFINE_OWNED_WINDOW_PROPERTY_KEY(WindowSettings,
- kWindowSettingsKey, NULL);
-
-WindowSettings::WindowSettings(aura::Window* window)
- : window_(window),
- tracked_by_workspace_(true),
- window_position_managed_(false),
- bounds_changed_by_user_(false),
- panel_attached_(true),
- continue_drag_after_reparent_(false),
- ignored_by_shelf_(false) {
-}
-
-WindowSettings::~WindowSettings() {
-}
-
-void WindowSettings::AddObserver(Observer* observer) {
- observer_list_.AddObserver(observer);
-}
-
-void WindowSettings::RemoveObserver(Observer* observer) {
- observer_list_.RemoveObserver(observer);
-}
-
-void WindowSettings::SetTrackedByWorkspace(bool tracked_by_workspace) {
- if (tracked_by_workspace_ == tracked_by_workspace)
- return;
- bool old = tracked_by_workspace_;
- tracked_by_workspace_ = tracked_by_workspace;
- FOR_EACH_OBSERVER(Observer, observer_list_,
- OnTrackedByWorkspaceChanged(window_, old));
-}
-
-WindowSettings* GetWindowSettings(aura::Window* window) {
- WindowSettings* settings = window->GetProperty(kWindowSettingsKey);
- if(!settings) {
- settings = new WindowSettings(window);
- window->SetProperty(kWindowSettingsKey, settings);
- }
- return settings;
-}
-
-const WindowSettings* GetWindowSettings(const aura::Window* window) {
- return GetWindowSettings(const_cast<aura::Window*>(window));
-}
-
-} // namespace wm
-} // namespace ash
diff --git a/ash/wm/window_settings.h b/ash/wm/window_settings.h
deleted file mode 100644
index 001e18d..0000000
--- a/ash/wm/window_settings.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_WM_WINDOW_SETTINGS_H_
-#define ASH_WM_WINDOW_SETTINGS_H_
-
-#include "ash/ash_export.h"
-#include "base/basictypes.h"
-#include "base/observer_list.h"
-
-namespace aura {
-class Window;
-}
-
-namespace ash {
-namespace wm {
-
-// Per managed window information should be stored here
-// instead of using plain aura window property.
-class ASH_EXPORT WindowSettings {
- public:
- class Observer {
- public:
- // Called when the tracked_by_workspace has changed.
- virtual void OnTrackedByWorkspaceChanged(aura::Window* window,
- bool old_value) {}
- };
-
- explicit WindowSettings(aura::Window* window);
- ~WindowSettings();
-
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
-
- // Whether the window is tracked by workspace code. Default is
- // true. If set to false the workspace does not switch the current
- // workspace, nor does it attempt to impose constraints on the
- // bounds of the window. This is intended for tab dragging.
- bool tracked_by_workspace() const { return tracked_by_workspace_; }
- void SetTrackedByWorkspace(bool tracked_by_workspace);
-
- // Whether or not the window's position can be managed by the
- // auto management logic.
- bool window_position_managed() const { return window_position_managed_; }
- void set_window_position_managed(bool window_position_managed) {
- window_position_managed_ = window_position_managed;
- }
-
- // Whether or not the window's position or size was changed by a user.
- bool bounds_changed_by_user() const { return bounds_changed_by_user_; }
- void set_bounds_changed_by_user(bool bounds_changed_by_user) {
- bounds_changed_by_user_ = bounds_changed_by_user;
- }
-
- // True if this window is an attached panel.
- bool panel_attached() const {
- return panel_attached_;
- }
- void set_panel_attached(bool panel_attached) {
- panel_attached_ = panel_attached;
- }
-
- // Indicates that an in progress drag should be continued after the
- // window is reparented to another container.
- bool continue_drag_after_reparent() const {
- return continue_drag_after_reparent_;
- }
- void set_continue_drag_after_reparent(bool value) {
- continue_drag_after_reparent_ = value;
- }
-
- // True if the window is ignored by the shelf layout manager for
- // purposes of darkening the shelf.
- bool ignored_by_shelf() const { return ignored_by_shelf_; }
- void set_ignored_by_shelf(bool ignored_by_shelf) {
- ignored_by_shelf_ = ignored_by_shelf;
- }
-
- private:
- // The owner of this window settings.
- aura::Window* window_;
-
- bool tracked_by_workspace_;
- bool window_position_managed_;
- bool bounds_changed_by_user_;
- bool panel_attached_;
- bool continue_drag_after_reparent_;
- bool ignored_by_shelf_;
-
- ObserverList<Observer> observer_list_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowSettings);
-};
-
-// Returns the WindowSettings for |window|. Creates WindowSettings
-// if it didn't exist. The settings object is owned by |window|.
-ASH_EXPORT WindowSettings* GetWindowSettings(aura::Window* window);
-
-// const version of GetWindowSettings.
-ASH_EXPORT const WindowSettings*
-GetWindowSettings(const aura::Window* window);
-
-} // namespace wm
-} // namespace ash
-
-#endif // ASH_WM_WINDOW_SETTINGS_H_
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 3f0f234..ca205e9 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -132,10 +132,28 @@ void CenterWindow(aura::Window* window) {
window->SetBoundsInScreen(center, display);
}
+bool IsWindowPositionManaged(const aura::Window* window) {
+ return window->GetProperty(ash::internal::kWindowPositionManagedKey);
+}
+
+void SetWindowPositionManaged(aura::Window* window, bool managed) {
+ window->SetProperty(ash::internal::kWindowPositionManagedKey, managed);
+}
+
void SetAnimateToFullscreen(aura::Window* window, bool animate) {
window->SetProperty(ash::internal::kAnimateToFullscreenKey, animate);
}
+bool HasUserChangedWindowPositionOrSize(const aura::Window* window) {
+ return window->GetProperty(
+ ash::internal::kUserChangedWindowPositionOrSizeKey);
+}
+
+void SetUserHasChangedWindowPositionOrSize(aura::Window* window, bool changed) {
+ window->SetProperty(ash::internal::kUserChangedWindowPositionOrSizeKey,
+ changed);
+}
+
const gfx::Rect* GetPreAutoManageWindowBounds(const aura::Window* window) {
return window->GetProperty(ash::internal::kPreAutoManagedWindowBoundsKey);
}
diff --git a/ash/wm/window_util.h b/ash/wm/window_util.h
index a911099..c114b8d 100644
--- a/ash/wm/window_util.h
+++ b/ash/wm/window_util.h
@@ -83,9 +83,22 @@ ASH_EXPORT void ToggleMaximizedWindow(aura::Window* window);
// Moves the window to the center of the display.
ASH_EXPORT void CenterWindow(aura::Window* window);
+// Returns true if |window|'s position can automatically be managed.
+ASH_EXPORT bool IsWindowPositionManaged(const aura::Window* window);
+
+// Change the |window|'s position manageability to |managed|.
+ASH_EXPORT void SetWindowPositionManaged(aura::Window* window, bool managed);
+
// Change the availability of animation to the fullscreen of the |window|.
ASH_EXPORT void SetAnimateToFullscreen(aura::Window* window, bool animate);
+// Returns true if the user has changed the |window|'s position or size.
+ASH_EXPORT bool HasUserChangedWindowPositionOrSize(const aura::Window* window);
+
+// Marks a |window|'s coordinates to be changed by a user.
+ASH_EXPORT void SetUserHasChangedWindowPositionOrSize(aura::Window* window,
+ bool changed);
+
// Get |window| bounds of the window before it was moved by the auto window
// management. As long as it was not managed, it will return NULL.
ASH_EXPORT const gfx::Rect* GetPreAutoManageWindowBounds(
diff --git a/ash/wm/workspace/auto_window_management.cc b/ash/wm/workspace/auto_window_management.cc
index 97cf2e8..ddcd19c 100644
--- a/ash/wm/workspace/auto_window_management.cc
+++ b/ash/wm/workspace/auto_window_management.cc
@@ -9,7 +9,6 @@
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
-#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/aura/window.h"
@@ -29,20 +28,18 @@ const int kWindowAutoMoveDurationMS = 125;
// Check if any management should be performed (with a given |window|).
bool UseAutoWindowManager(const aura::Window* window) {
- const wm::WindowSettings* settings = wm::GetWindowSettings(window);
- return settings->tracked_by_workspace() &&
- settings->window_position_managed();
+ return GetTrackedByWorkspace(window) &&
+ wm::IsWindowPositionManaged(window);
}
// Check if a given |window| can be managed. This includes that it's state is
// not minimized/maximized/the user has changed it's size by hand already.
// It furthermore checks for the WindowIsManaged status.
bool WindowPositionCanBeManaged(const aura::Window* window) {
- const wm::WindowSettings* settings = wm::GetWindowSettings(window);
- return settings->window_position_managed() &&
- !wm::IsWindowMinimized(window) &&
- !wm::IsWindowMaximized(window) &&
- !settings->bounds_changed_by_user();
+ return (wm::IsWindowPositionManaged(window) &&
+ !wm::IsWindowMinimized(window) &&
+ !wm::IsWindowMaximized(window) &&
+ !wm::HasUserChangedWindowPositionOrSize(window));
}
// Get the work area for a given |window|.
@@ -152,7 +149,7 @@ aura::Window* GetReferenceWindow(const aura::RootWindow* root_window,
window->type() == aura::client::WINDOW_TYPE_NORMAL &&
window->GetRootWindow() == root_window &&
window->TargetVisibility() &&
- wm::GetWindowSettings(window)->window_position_managed()) {
+ wm::IsWindowPositionManaged(window)) {
if (found && found != window) {
// no need to check !signle_window because the function must have
// been already returned in the "if (!single_window)" below.
@@ -185,7 +182,7 @@ void RearrangeVisibleWindowOnHideOrRemove(const aura::Window* removed_window) {
void RearrangeVisibleWindowOnShow(aura::Window* added_window) {
if (!UseAutoWindowManager(added_window) ||
- wm::GetWindowSettings(added_window)->bounds_changed_by_user() ||
+ wm::HasUserChangedWindowPositionOrSize(added_window) ||
!added_window->TargetVisibility())
return;
// Find a single open managed window.
@@ -212,9 +209,8 @@ void RearrangeVisibleWindowOnShow(aura::Window* added_window) {
if (single_window) {
// When going from one to two windows both windows loose their "positioned
// by user" flags.
- wm::GetWindowSettings(added_window)->set_bounds_changed_by_user(false);
- wm::GetWindowSettings(other_shown_window)->
- set_bounds_changed_by_user(false);
+ ash::wm::SetUserHasChangedWindowPositionOrSize(added_window, false);
+ ash::wm::SetUserHasChangedWindowPositionOrSize(other_shown_window, false);
if (WindowPositionCanBeManaged(other_shown_window)) {
// Don't override pre auto managed bounds as the current bounds
diff --git a/ash/wm/workspace/colored_window_controller.cc b/ash/wm/workspace/colored_window_controller.cc
index 81339b5..08c3dc0 100644
--- a/ash/wm/workspace/colored_window_controller.cc
+++ b/ash/wm/workspace/colored_window_controller.cc
@@ -5,7 +5,7 @@
#include "ash/wm/workspace/colored_window_controller.h"
#include "ash/shell_window_ids.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/property_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/gfx/canvas.h"
@@ -65,7 +65,7 @@ ColoredWindowController::ColoredWindowController(aura::Window* parent,
widget->Init(params);
// Do this so the parent doesn't attempt to enforce any bounds constraints on
// us.
- wm::GetWindowSettings(widget->GetNativeView())->SetTrackedByWorkspace(false);
+ SetTrackedByWorkspace(widget->GetNativeView(), false);
widget->GetNativeView()->SetProperty(aura::client::kAnimationsDisabledKey,
true);
widget->GetNativeView()->SetName(window_name);
diff --git a/ash/wm/workspace/frame_caption_button_container_view.cc b/ash/wm/workspace/frame_caption_button_container_view.cc
index ddf602f..962f847 100644
--- a/ash/wm/workspace/frame_caption_button_container_view.cc
+++ b/ash/wm/workspace/frame_caption_button_container_view.cc
@@ -6,7 +6,7 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/property_util.h"
#include "ash/wm/workspace/frame_maximize_button.h"
#include "grit/ash_resources.h"
#include "grit/ui_strings.h" // Accessibility names
@@ -128,8 +128,7 @@ void FrameCaptionButtonContainerView::Layout() {
// The new assets only make sense if the window is maximized or fullscreen
// because we usually use a black header in this case.
if ((frame_->IsMaximized() || frame_->IsFullscreen()) &&
- wm::GetWindowSettings(
- frame_->GetNativeWindow())->tracked_by_workspace()) {
+ GetTrackedByWorkspace(frame_->GetNativeWindow())) {
SetButtonImages(size_button_,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE2,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE2_H,
diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc
index 08980c2..78438f0 100644
--- a/ash/wm/workspace/frame_maximize_button.cc
+++ b/ash/wm/workspace/frame_maximize_button.cc
@@ -13,11 +13,11 @@
#include "ash/wm/maximize_bubble_controller.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
+#include "ash/wm/window_util.h"
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "grit/ash_strings.h"
-#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/base/events/event.h"
#include "ui/base/events/event_handler.h"
@@ -176,7 +176,11 @@ void FrameMaximizeButton::OnWindowBoundsChanged(
void FrameMaximizeButton::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) {
- Cancel(false);
+ // Changing the window position is managed status should not Cancel.
+ // Note that this case might happen when a non user managed window
+ // transitions from maximized to L/R maximized.
+ if (key != ash::internal::kWindowPositionManagedKey)
+ Cancel(false);
}
void FrameMaximizeButton::OnWindowDestroying(aura::Window* window) {
@@ -539,9 +543,9 @@ void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) {
// The auto position manager will kick in when this is the only window.
// To avoid interference with it we tell it temporarily to not change
// the coordinates of this window.
- wm::WindowSettings* settings = wm::GetWindowSettings(window);
- bool was_managed = settings->window_position_managed();
- settings->set_window_position_managed(false);
+ bool is_managed = ash::wm::IsWindowPositionManaged(window);
+ if (is_managed)
+ ash::wm::SetWindowPositionManaged(window, false);
// Set the restore size we want to restore to.
ash::SetRestoreBoundsInScreen(window,
@@ -551,7 +555,8 @@ void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) {
// After the window is where we want it to be we allow the window to be
// auto managed again.
- settings->set_window_position_managed(was_managed);
+ if (is_managed)
+ ash::wm::SetWindowPositionManaged(window, true);
} else {
// Others might also have set up a restore rectangle already. If so,
// we should not overwrite the restore rectangle.
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 258fd86..b39213e 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -14,7 +14,6 @@
#include "ash/wm/frame_painter.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
-#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/auto_window_management.h"
#include "ui/aura/client/aura_constants.h"
@@ -119,7 +118,7 @@ void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child,
void WorkspaceLayoutManager::SetChildBounds(
Window* child,
const gfx::Rect& requested_bounds) {
- if (!wm::GetWindowSettings(child)->tracked_by_workspace()) {
+ if (!GetTrackedByWorkspace(child)) {
SetChildBoundsDirect(child, requested_bounds);
return;
}
@@ -145,12 +144,6 @@ void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() {
}
}
-void WorkspaceLayoutManager::OnTrackedByWorkspaceChanged(Window* window,
- bool old){
- if (wm::GetWindowSettings(window)->tracked_by_workspace())
- SetMaximizedOrFullscreenBounds(window);
-}
-
void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
const void* key,
intptr_t old) {
@@ -186,6 +179,11 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
SetRestoreBoundsInScreen(window, restore);
}
+ if (key == internal::kWindowTrackedByWorkspaceKey &&
+ GetTrackedByWorkspace(window)) {
+ SetMaximizedOrFullscreenBounds(window);
+ }
+
if (key == aura::client::kAlwaysOnTopKey &&
window->GetProperty(aura::client::kAlwaysOnTopKey)) {
internal::AlwaysOnTopController* controller =
@@ -211,7 +209,7 @@ void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange(
void WorkspaceLayoutManager::AdjustWindowBoundsForWorkAreaChange(
Window* window,
AdjustWindowReason reason) {
- if (!wm::GetWindowSettings(window)->tracked_by_workspace())
+ if (!GetTrackedByWorkspace(window))
return;
// Do not cross fade here: the window's layer hierarchy may be messed up for
@@ -253,7 +251,7 @@ void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded(
if (window->bounds().IsEmpty())
return;
- if (!wm::GetWindowSettings(window)->tracked_by_workspace())
+ if (!GetTrackedByWorkspace(window))
return;
if (SetMaximizedOrFullscreenBounds(window))
@@ -342,7 +340,7 @@ void WorkspaceLayoutManager::UpdateBoundsFromShowState(Window* window) {
bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds(
aura::Window* window) {
- if (!wm::GetWindowSettings(window)->tracked_by_workspace())
+ if (!GetTrackedByWorkspace(window))
return false;
// During animations there is a transform installed on the workspace
diff --git a/ash/wm/workspace/workspace_layout_manager.h b/ash/wm/workspace/workspace_layout_manager.h
index b0d5fa9..4476ddc 100644
--- a/ash/wm/workspace/workspace_layout_manager.h
+++ b/ash/wm/workspace/workspace_layout_manager.h
@@ -56,10 +56,6 @@ class ASH_EXPORT WorkspaceLayoutManager : public BaseLayoutManager {
const void* key,
intptr_t old) OVERRIDE;
- // ash::WindowSettings::Observer overrides:
- virtual void OnTrackedByWorkspaceChanged(aura::Window* window,
- bool old) OVERRIDE;
-
private:
// Overridden from BaseLayoutManager:
virtual void ShowStateChanged(aura::Window* window,
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 4bff261..5ec242f 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -11,7 +11,6 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
@@ -309,7 +308,7 @@ TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) {
parent->RemoveChild(out_window.get());
out_window->SetBounds(gfx::Rect(-200, -200, 200, 200));
// UserHasChangedWindowPositionOrSize flag shouldn't turn off this behavior.
- wm::GetWindowSettings(window.get())->set_bounds_changed_by_user(true);
+ wm::SetUserHasChangedWindowPositionOrSize(window.get(), true);
parent->AddChild(out_window.get());
EXPECT_GT(bounds.width(), out_window->bounds().width() * 0.29);
EXPECT_GT(bounds.height(), out_window->bounds().height() * 0.29);
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index f68e64d..4b8c0aa 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -20,7 +20,7 @@
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/panels/panel_window_resizer.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/snap_sizer.h"
@@ -67,10 +67,8 @@ scoped_ptr<WindowResizer> CreateWindowResizer(
// Allow dragging maximized windows if it's not tracked by workspace. This
// is set by tab dragging code.
if (!wm::IsWindowNormal(window) &&
- (window_component != HTCAPTION ||
- wm::GetWindowSettings(window)->tracked_by_workspace())) {
+ (window_component != HTCAPTION || GetTrackedByWorkspace(window)))
return scoped_ptr<WindowResizer>();
- }
window_resizer = internal::WorkspaceWindowResizer::Create(
window,
point_in_parent,
@@ -403,7 +401,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent,
}
void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
- wm::GetWindowSettings(details_.window)->set_bounds_changed_by_user(true);
+ wm::SetUserHasChangedWindowPositionOrSize(details_.window, true);
snap_phantom_window_controller_.reset();
if (!did_move_or_resize_ || details_.window_component != HTCAPTION)
return;
@@ -415,7 +413,7 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) {
// is called, so it does not matter.
if (wm::IsWindowNormal(window()) &&
(window()->type() != aura::client::WINDOW_TYPE_PANEL ||
- !wm::GetWindowSettings(window())->panel_attached()) &&
+ !window()->GetProperty(kPanelAttachedKey)) &&
(snap_type_ == SNAP_LEFT_EDGE || snap_type_ == SNAP_RIGHT_EDGE)) {
if (!GetRestoreBoundsInScreen(window())) {
gfx::Rect initial_bounds = ScreenAsh::ConvertRectToScreen(
@@ -701,8 +699,7 @@ bool WorkspaceWindowResizer::UpdateMagnetismWindow(const gfx::Rect& bounds,
// Avoid magnetically snapping to popups, menus, tooltips, controls and
// windows that are not tracked by workspace.
- if (!wm::CanResizeWindow(window()) ||
- !wm::GetWindowSettings(window())->tracked_by_workspace())
+ if (!wm::CanResizeWindow(window()) || !GetTrackedByWorkspace(window()))
return false;
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
@@ -862,7 +859,7 @@ void WorkspaceWindowResizer::UpdateSnapPhantomWindow(const gfx::Point& location,
return;
if (window()->type() == aura::client::WINDOW_TYPE_PANEL &&
- wm::GetWindowSettings(window())->panel_attached()) {
+ window()->GetProperty(kPanelAttachedKey)) {
return;
}
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 18520c5..80e0fd2 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -14,7 +14,6 @@
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/snap_sizer.h"
@@ -1422,8 +1421,7 @@ TEST_F(WorkspaceWindowResizerTest, CheckUserWindowMangedFlags) {
EXPECT_EQ("0,150 400x200", window_->bounds().ToString());
resizer->RevertDrag();
- EXPECT_FALSE(
- wm::GetWindowSettings(window_.get())->bounds_changed_by_user());
+ EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window_.get()));
}
// Check that a completed move / size does change the user coordinates.
@@ -1436,8 +1434,7 @@ TEST_F(WorkspaceWindowResizerTest, CheckUserWindowMangedFlags) {
resizer->Drag(CalculateDragPoint(*resizer, 0, 100), 0);
EXPECT_EQ("0,150 400x200", window_->bounds().ToString());
resizer->CompleteDrag(0);
- EXPECT_TRUE(
- wm::GetWindowSettings(window_.get())->bounds_changed_by_user());
+ EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window_.get()));
}
}
diff --git a/ash/wm/workspace_controller.cc b/ash/wm/workspace_controller.cc
index 64e69e2..7fbbda2 100644
--- a/ash/wm/workspace_controller.cc
+++ b/ash/wm/workspace_controller.cc
@@ -10,7 +10,7 @@
#include "ash/wm/base_layout_manager.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_animations.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/workspace_event_handler.h"
#include "ash/wm/workspace/workspace_layout_manager.h"
@@ -65,7 +65,7 @@ WorkspaceWindowState WorkspaceController::GetWindowState() const {
bool has_maximized_window = false;
for (aura::Window::Windows::const_iterator i = windows.begin();
i != windows.end(); ++i) {
- if (wm::GetWindowSettings(*i)->ignored_by_shelf())
+ if (GetIgnoredByShelf(*i))
continue;
ui::Layer* layer = (*i)->layer();
if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f)
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index 39b1906..4327225 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -17,7 +17,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/shell_test_api.h"
#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
@@ -103,9 +103,8 @@ class WorkspaceControllerTest : public test::AshTestBase {
aura::Window* CreateBrowserLikeWindow(const gfx::Rect& bounds) {
aura::Window* window = CreateTestWindow();
window->SetBounds(bounds);
- wm::WindowSettings* settings = wm::GetWindowSettings(window);
- settings->SetTrackedByWorkspace(true);
- settings->set_window_position_managed(true);
+ SetTrackedByWorkspace(window, true);
+ wm::SetWindowPositionManaged(window, true);
window->Show();
return window;
}
@@ -353,7 +352,7 @@ TEST_F(WorkspaceControllerTest, ShelfStateUpdated) {
// A visible ignored window should not trigger the overlap.
scoped_ptr<Window> w_ignored(CreateTestWindow());
w_ignored->SetBounds(touches_shelf_bounds);
- wm::GetWindowSettings(&(*w_ignored))->set_ignored_by_shelf(true);
+ SetIgnoredByShelf(&(*w_ignored), true);
w_ignored->Show();
EXPECT_FALSE(GetWindowOverlapsShelf());
@@ -695,7 +694,7 @@ TEST_F(WorkspaceControllerTest, TrackedByWorkspace) {
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
SetDefaultParentByPrimaryRootWindow(w2.get());
w2->Show();
- wm::GetWindowSettings(w2.get())->SetTrackedByWorkspace(false);
+ SetTrackedByWorkspace(w2.get(), false);
wm::ActivateWindow(w2.get());
// Activating |w2| should force it to have the same parent as |w1|.
@@ -712,7 +711,7 @@ TEST_F(WorkspaceControllerTest, TrackedByWorkspace) {
// Transition it to tracked by worskpace. It should end up in the desktop
// workspace.
- wm::GetWindowSettings(w2.get())->SetTrackedByWorkspace(true);
+ SetTrackedByWorkspace(w2.get(), true);
EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
EXPECT_TRUE(w1->IsVisible());
EXPECT_TRUE(w2->IsVisible());
@@ -800,10 +799,9 @@ TEST_F(WorkspaceControllerTest, BasicAutoPlacingOnShowHide) {
EXPECT_EQ("16,32 640x320", window1->bounds().ToString());
// Test 2: Set up two managed windows and check their auto positioning.
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
-
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
scoped_ptr<aura::Window> window3(CreateTestWindowInShellWithId(2));
- wm::GetWindowSettings(window3.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window3.get(), true);
// To avoid any auto window manager changes due to SetBounds, the window
// gets first hidden and then shown again.
window3->Hide();
@@ -840,7 +838,7 @@ TEST_F(WorkspaceControllerTest, BasicAutoPlacingOnShowHide) {
// Test4: A single manageable window should get centered.
window4.reset();
- wm::GetWindowSettings(window1.get())->set_bounds_changed_by_user(false);
+ ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), false);
// Trigger the auto window placement function by showing (and hiding) it.
window1->Hide();
window1->Show();
@@ -860,19 +858,19 @@ TEST_F(WorkspaceControllerTest, TestUserMovedWindowRepositioning) {
window2->SetBounds(gfx::Rect(32, 48, 256, 512));
window1->Hide();
window2->Hide();
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
- EXPECT_FALSE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user());
- EXPECT_FALSE(wm::GetWindowSettings(window2.get())->bounds_changed_by_user());
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
+ EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get()));
+ EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window2.get()));
// Check that the current location gets preserved if the user has
// positioned it previously.
- wm::GetWindowSettings(window1.get())->set_bounds_changed_by_user(true);
+ ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), true);
window1->Show();
EXPECT_EQ("16,32 640x320", window1->bounds().ToString());
// Flag should be still set.
- EXPECT_TRUE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user());
- EXPECT_FALSE(wm::GetWindowSettings(window2.get())->bounds_changed_by_user());
+ EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get()));
+ EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window2.get()));
// Turn on the second window and make sure that both windows are now
// positionable again (user movement cleared).
@@ -884,14 +882,14 @@ TEST_F(WorkspaceControllerTest, TestUserMovedWindowRepositioning) {
base::IntToString(desktop_area.width() - window2->bounds().width()) +
",48 256x512", window2->bounds().ToString());
// FLag should now be reset.
- EXPECT_FALSE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user());
- EXPECT_FALSE(wm::GetWindowSettings(window2.get())->bounds_changed_by_user());
+ EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get()));
+ EXPECT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get()));
// Going back to one shown window should keep the state.
- wm::GetWindowSettings(window1.get())->set_bounds_changed_by_user(true);
+ ash::wm::SetUserHasChangedWindowPositionOrSize(window1.get(), true);
window2->Hide();
EXPECT_EQ("0,32 640x320", window1->bounds().ToString());
- EXPECT_TRUE(wm::GetWindowSettings(window1.get())->bounds_changed_by_user());
+ EXPECT_TRUE(ash::wm::HasUserChangedWindowPositionOrSize(window1.get()));
}
// Test if the single window will be restored at original position.
@@ -905,9 +903,9 @@ TEST_F(WorkspaceControllerTest, TestSingleWindowsRestoredBounds) {
window1->Hide();
window2->Hide();
window3->Hide();
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
- wm::GetWindowSettings(window3.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
+ ash::wm::SetWindowPositionManaged(window3.get(), true);
window1->Show();
wm::ActivateWindow(window1.get());
@@ -956,8 +954,8 @@ TEST_F(WorkspaceControllerTest, TestUserHandledWindowRestore) {
window2->SetBounds(gfx::Rect(32, 48, 256, 512));
window1->Hide();
window2->Hide();
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
window1->Show();
EXPECT_EQ(user_pos.ToString(), window1->bounds().ToString());
window2->Show();
@@ -981,12 +979,12 @@ TEST_F(WorkspaceControllerTest, TestUserHandledWindowRestore) {
// Test that a window from normal to minimize will repos the remaining.
TEST_F(WorkspaceControllerTest, ToMinimizeRepositionsRemaining) {
scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0));
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
window1->SetBounds(gfx::Rect(16, 32, 640, 320));
gfx::Rect desktop_area = window1->parent()->bounds();
scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1));
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
window2->SetBounds(gfx::Rect(32, 48, 256, 512));
ash::wm::MinimizeWindow(window1.get());
@@ -1009,11 +1007,11 @@ TEST_F(WorkspaceControllerTest, ToMinimizeRepositionsRemaining) {
// Test that minimizing an initially maximized window will repos the remaining.
TEST_F(WorkspaceControllerTest, MaxToMinRepositionsRemaining) {
scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0));
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
gfx::Rect desktop_area = window1->parent()->bounds();
scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1));
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
window2->SetBounds(gfx::Rect(32, 48, 256, 512));
ash::wm::MaximizeWindow(window1.get());
@@ -1031,11 +1029,11 @@ TEST_F(WorkspaceControllerTest, MaxToMinRepositionsRemaining) {
TEST_F(WorkspaceControllerTest, NormToMaxToMinRepositionsRemaining) {
scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0));
window1->SetBounds(gfx::Rect(16, 32, 640, 320));
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
gfx::Rect desktop_area = window1->parent()->bounds();
scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1));
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
window2->SetBounds(gfx::Rect(32, 40, 256, 512));
// Trigger the auto window placement function by showing (and hiding) it.
@@ -1063,11 +1061,11 @@ TEST_F(WorkspaceControllerTest, NormToMaxToMinRepositionsRemaining) {
TEST_F(WorkspaceControllerTest, NormToMaxToNormRepositionsRemaining) {
scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0));
window1->SetBounds(gfx::Rect(16, 32, 640, 320));
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
gfx::Rect desktop_area = window1->parent()->bounds();
scoped_ptr<aura::Window> window2(CreateTestWindowInShellWithId(1));
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
window2->SetBounds(gfx::Rect(32, 40, 256, 512));
// Trigger the auto window placement function by showing (and hiding) it.
@@ -1102,8 +1100,8 @@ TEST_F(WorkspaceControllerTest, AnimatedNormToMaxToNormRepositionsRemaining) {
window2->Hide();
window2->SetBounds(gfx::Rect(32, 48, 256, 512));
- wm::GetWindowSettings(window1.get())->set_window_position_managed(true);
- wm::GetWindowSettings(window2.get())->set_window_position_managed(true);
+ ash::wm::SetWindowPositionManaged(window1.get(), true);
+ ash::wm::SetWindowPositionManaged(window2.get(), true);
// Make sure nothing is animating.
window1->layer()->GetAnimator()->StopAnimating();
window2->layer()->GetAnimator()->StopAnimating();
@@ -1277,7 +1275,7 @@ TEST_F(WorkspaceControllerTest, DragFullscreenNonTrackedWindow) {
EXPECT_EQ(0, observer.change_count());
// Set tracked to false and repeat, now the window should move.
- wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(false);
+ SetTrackedByWorkspace(w1.get(), false);
generator.MoveMouseTo(5, 5);
generator.PressLeftButton();
generator.MoveMouseBy(100, 100);
@@ -1286,7 +1284,7 @@ TEST_F(WorkspaceControllerTest, DragFullscreenNonTrackedWindow) {
w1->bounds().ToString());
generator.ReleaseLeftButton();
- wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(true);
+ SetTrackedByWorkspace(w1.get(), true);
// Marking the window tracked again should snap back to origin.
EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
EXPECT_EQ(0, observer.change_count());
@@ -1326,7 +1324,7 @@ TEST_F(WorkspaceControllerTest, DragMaximizedNonTrackedWindow) {
EXPECT_EQ(0, observer.change_count());
// Set tracked to false and repeat, now the window should move.
- wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(false);
+ SetTrackedByWorkspace(w1.get(), false);
generator.MoveMouseTo(5, 5);
generator.PressLeftButton();
generator.MoveMouseBy(100, 100);
@@ -1335,7 +1333,7 @@ TEST_F(WorkspaceControllerTest, DragMaximizedNonTrackedWindow) {
w1->bounds().ToString());
generator.ReleaseLeftButton();
- wm::GetWindowSettings(w1.get())->SetTrackedByWorkspace(true);
+ SetTrackedByWorkspace(w1.get(), true);
// Marking the window tracked again should snap back to origin.
EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
EXPECT_EQ(0, observer.change_count());