summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 05:05:12 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 05:05:12 +0000
commitdd4f1c9e59f689eb7776c4a810366c6cf99f0f40 (patch)
tree5c61b2f94588a6d8832f3f2687b9b4655799f3c3 /ash
parent8c321d863b9acd641cb34aaaba8f419cfc0f839b (diff)
downloadchromium_src-dd4f1c9e59f689eb7776c4a810366c6cf99f0f40.zip
chromium_src-dd4f1c9e59f689eb7776c4a810366c6cf99f0f40.tar.gz
chromium_src-dd4f1c9e59f689eb7776c4a810366c6cf99f0f40.tar.bz2
Makes windows no longer open maximized by default.
BUG=116268 TEST=none R=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/9558004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc7
-rw-r--r--ash/wm/workspace/workspace_manager.cc20
-rw-r--r--ash/wm/workspace/workspace_manager.h20
-rw-r--r--ash/wm/workspace/workspace_manager_unittest.cc46
-rw-r--r--ash/wm/workspace_controller.cc18
-rw-r--r--ash/wm/workspace_controller.h1
6 files changed, 3 insertions, 109 deletions
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index b5376e8..0ac362cd 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -41,12 +41,7 @@ void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
if (child->IsVisible()) {
workspace_manager_->AddWindow(child);
- } else if (wm::IsWindowMaximized(child) ||
- workspace_manager_->ShouldMaximize(child)) {
- if (!wm::IsWindowMaximized(child)) {
- SetRestoreBoundsIfNotSet(child);
- wm::MaximizeWindow(child);
- }
+ } else if (wm::IsWindowMaximized(child)) {
SetChildBoundsDirect(child,
gfx::Screen::GetMonitorWorkAreaNearestWindow(child));
} else if (wm::IsWindowFullscreen(child)) {
diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc
index b16a35f..3e8d25a 100644
--- a/ash/wm/workspace/workspace_manager.cc
+++ b/ash/wm/workspace/workspace_manager.cc
@@ -64,9 +64,6 @@ namespace internal {
////////////////////////////////////////////////////////////////////////////////
// WindowManager, public:
-// static
-const int WorkspaceManager::kOpenMaximizedThreshold = 1600;
-
WorkspaceManager::WorkspaceManager(aura::Window* contents_view)
: contents_view_(contents_view),
active_workspace_(NULL),
@@ -75,7 +72,6 @@ WorkspaceManager::WorkspaceManager(aura::Window* contents_view)
is_overview_(false),
ignored_window_(NULL),
grid_size_(0),
- open_new_windows_maximized_(true),
shelf_(NULL) {
DCHECK(contents_view);
}
@@ -95,12 +91,6 @@ bool WorkspaceManager::IsManagedWindow(aura::Window* window) const {
!window->transient_parent();
}
-bool WorkspaceManager::ShouldMaximize(aura::Window* window) const {
- return !window->GetProperty(aura::client::kShowStateKey) &&
- open_new_windows_maximized_ &&
- contents_view_->bounds().width() < kOpenMaximizedThreshold;
-}
-
void WorkspaceManager::AddWindow(aura::Window* window) {
DCHECK(IsManagedWindow(window));
@@ -119,14 +109,8 @@ void WorkspaceManager::AddWindow(aura::Window* window) {
SetRestoreBounds(window, window->bounds());
}
- if (!window->GetProperty(aura::client::kShowStateKey)) {
- if (ShouldMaximize(window)) {
- window->SetProperty(aura::client::kShowStateKey,
- ui::SHOW_STATE_MAXIMIZED);
- } else {
- window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
- }
- }
+ if (!window->GetProperty(aura::client::kShowStateKey))
+ window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
if (wm::IsWindowMaximized(window) || wm::IsWindowFullscreen(window)) {
SetFullScreenOrMaximizedBounds(window);
diff --git a/ash/wm/workspace/workspace_manager.h b/ash/wm/workspace/workspace_manager.h
index 8adf5b96..dde10aa 100644
--- a/ash/wm/workspace/workspace_manager.h
+++ b/ash/wm/workspace/workspace_manager.h
@@ -33,19 +33,12 @@ class WorkspaceManagerTest;
// WorkspaceManager manages multiple workspaces in the desktop.
class ASH_EXPORT WorkspaceManager : public aura::WindowObserver{
public:
- // If open_new_windows_maximized() is true and the size of the viewport is
- // smaller than this value, newly created windows are forced maximized.
- static const int kOpenMaximizedThreshold;
-
explicit WorkspaceManager(aura::Window* viewport);
virtual ~WorkspaceManager();
// Returns true if |window| should be managed by the WorkspaceManager.
bool IsManagedWindow(aura::Window* window) const;
- // Returns true if |window| should be maximized.
- bool ShouldMaximize(aura::Window* window) const;
-
// Adds/removes a window creating/destroying workspace as necessary.
void AddWindow(aura::Window* window);
void RemoveWindow(aura::Window* window);
@@ -75,16 +68,6 @@ class ASH_EXPORT WorkspaceManager : public aura::WindowObserver{
// TODO: maybe this should be set on WorkspaceLayoutManager.
aura::Window* ignored_window() { return ignored_window_; }
- // Sets whether newly added windows open maximized. This is only applicable if
- // the size of the root window is less than kOpenMaximizedThreshold. Default
- // is true.
- void set_open_new_windows_maximized(bool value) {
- open_new_windows_maximized_ = value;
- }
- bool open_new_windows_maximized() const {
- return open_new_windows_maximized_;
- }
-
// Sets the size of the grid. Newly added windows are forced to align to the
// size of the grid.
void set_grid_size(int size) { grid_size_ = size; }
@@ -185,9 +168,6 @@ class ASH_EXPORT WorkspaceManager : public aura::WindowObserver{
// See description above setter.
int grid_size_;
- // See description above setter.
- bool open_new_windows_maximized_;
-
// Owned by the Shell container window LauncherContainer. May be NULL.
ShelfLayoutManager* shelf_;
diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc
index 7d9acd8..b8f9717 100644
--- a/ash/wm/workspace/workspace_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_manager_unittest.cc
@@ -300,52 +300,6 @@ TEST_F(WorkspaceManagerTest, ChangeBoundsOfNormalWindow) {
EXPECT_EQ(500, w1->bounds().height());
}
-// Assertions around open new windows maximized.
-TEST_F(WorkspaceManagerTest, OpenNewWindowsMaximized) {
- scoped_ptr<Window> w1(CreateTestWindowUnparented());
-
- // Default is true for open new windows maximized.
- EXPECT_TRUE(manager_->open_new_windows_maximized());
- // SHOW_STATE_DEFAULT should end up maximized.
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DEFAULT);
- w1->SetBounds(gfx::Rect(50, 51, 52, 53));
- w1->SetParent(GetViewport());
- // Maximized state and bounds should be set as soon as w1 is added to the
- // parent.
- EXPECT_TRUE(wm::IsWindowMaximized(w1.get()));
- EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(w1.get()),
- w1->bounds());
- w1->Show();
- EXPECT_TRUE(wm::IsWindowMaximized(w1.get()));
- EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(w1.get()),
- w1->bounds());
- // Restored bounds should be saved.
- ASSERT_TRUE(GetRestoreBounds(w1.get()));
- EXPECT_EQ(gfx::Rect(50, 51, 52, 53), *GetRestoreBounds(w1.get()));
-
- // Show state normal should end up normal.
- scoped_ptr<Window> w2(CreateTestWindow());
- w2->SetBounds(gfx::Rect(60, 61, 62, 63));
- w2->Show();
- EXPECT_EQ(gfx::Rect(60, 61, 62, 63), w2->bounds());
- EXPECT_EQ(ui::SHOW_STATE_NORMAL,
- w2->GetProperty(aura::client::kShowStateKey));
-
- // If open news windows maximized is false, SHOW_STATE_DEFAULT should end as
- // SHOW_STATE_NORMAL.
- manager_->set_open_new_windows_maximized(false);
- scoped_ptr<Window> w3(CreateTestWindowUnparented());
- // Show state default should end up normal when open new windows maximized is
- // false.
- w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DEFAULT);
- w3->SetBounds(gfx::Rect(70, 71, 72, 73));
- w3->SetParent(GetViewport());
- w3->Show();
- EXPECT_EQ(gfx::Rect(70, 71, 72, 73), w3->bounds());
- EXPECT_EQ(ui::SHOW_STATE_NORMAL,
- w3->GetProperty(aura::client::kShowStateKey));
-}
-
// Assertions around grid size.
TEST_F(WorkspaceManagerTest, SnapToGrid) {
manager_->set_grid_size(8);
diff --git a/ash/wm/workspace_controller.cc b/ash/wm/workspace_controller.cc
index 8222e52..77868fc 100644
--- a/ash/wm/workspace_controller.cc
+++ b/ash/wm/workspace_controller.cc
@@ -59,8 +59,6 @@ void WorkspaceController::ShowMenu(views::Widget* widget,
// the strings are localized.
menu_model.AddCheckItem(MENU_SNAP_TO_GRID,
ASCIIToUTF16("Snap to grid"));
- menu_model.AddCheckItem(MENU_OPEN_MAXIMIZED,
- ASCIIToUTF16("Maximize new windows"));
views::MenuModelAdapter menu_model_adapter(&menu_model);
menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
if (menu_runner_->RunMenuAt(
@@ -87,9 +85,6 @@ bool WorkspaceController::IsCommandIdChecked(int command_id) const {
case MENU_SNAP_TO_GRID:
return workspace_manager_->grid_size() != 0;
- case MENU_OPEN_MAXIMIZED:
- return workspace_manager_->open_new_windows_maximized();
-
default:
break;
}
@@ -97,14 +92,6 @@ bool WorkspaceController::IsCommandIdChecked(int command_id) const {
}
bool WorkspaceController::IsCommandIdEnabled(int command_id) const {
- switch (static_cast<MenuItem>(command_id)) {
- case MENU_OPEN_MAXIMIZED:
- return workspace_manager_->contents_view()->bounds().width() <
- WorkspaceManager::kOpenMaximizedThreshold;
-
- default:
- return true;
- }
return true;
}
@@ -125,11 +112,6 @@ void WorkspaceController::ExecuteCommand(int command_id) {
}
break;
}
-
- case MENU_OPEN_MAXIMIZED:
- workspace_manager_->set_open_new_windows_maximized(
- !workspace_manager_->open_new_windows_maximized());
- break;
}
}
diff --git a/ash/wm/workspace_controller.h b/ash/wm/workspace_controller.h
index 7ea212b..9907d8d 100644
--- a/ash/wm/workspace_controller.h
+++ b/ash/wm/workspace_controller.h
@@ -74,7 +74,6 @@ class ASH_EXPORT WorkspaceController :
private:
enum MenuItem {
MENU_SNAP_TO_GRID,
- MENU_OPEN_MAXIMIZED,
};
aura::Window* viewport_;