diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 20:17:45 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 20:17:45 +0000 |
commit | ad0c872627409562edfb75e049ad5184f04d2967 (patch) | |
tree | da354f8d404be002d05eb6012caaf7b6b4a26649 | |
parent | 0c8698f841ca346d9a722c81b119762d4bba59dd (diff) | |
download | chromium_src-ad0c872627409562edfb75e049ad5184f04d2967.zip chromium_src-ad0c872627409562edfb75e049ad5184f04d2967.tar.gz chromium_src-ad0c872627409562edfb75e049ad5184f04d2967.tar.bz2 |
Switch default WM mode to managed
Don't align window to grid when restoring window.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/9513004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124718 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/shell.cc | 11 | ||||
-rw-r--r-- | ash/shell.h | 6 | ||||
-rw-r--r-- | ash/shell_unittest.cc | 12 | ||||
-rw-r--r-- | ash/wm/root_window_event_filter_unittest.cc | 7 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_manager.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_tabs_apitest.cc | 12 |
6 files changed, 42 insertions, 8 deletions
diff --git a/ash/shell.cc b/ash/shell.cc index 519c9ee..452f69f 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -277,7 +277,7 @@ Shell::Shell(ShellDelegate* delegate) audio_controller_(NULL), brightness_controller_(NULL), shelf_(NULL), - window_mode_(MODE_OVERLAPPING), + window_mode_(MODE_MANAGED), desktop_background_mode_(BACKGROUND_IMAGE), root_window_layout_(NULL), status_widget_(NULL) { @@ -495,8 +495,8 @@ Shell::WindowMode Shell::ComputeWindowMode(CommandLine* command_line) const { return MODE_OVERLAPPING; } - // Overlapping is the default. - return Shell::MODE_OVERLAPPING; + // Managed is the default. + return Shell::MODE_MANAGED; } aura::Window* Shell::GetContainer(int container_id) { @@ -671,4 +671,9 @@ void Shell::ResetLayoutManager(int container_id) { GetContainer(container_id)->SetLayoutManager(NULL); } +void Shell::DisableWorkspaceGridLayout() { + if (workspace_controller_.get()) + workspace_controller_->workspace_manager()->set_grid_size(0); +} + } // namespace ash diff --git a/ash/shell.h b/ash/shell.h index 1ef873cd..4d70bbd 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -226,6 +226,9 @@ class ASH_EXPORT Shell { } private: + FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors); + FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate); + typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; explicit Shell(ShellDelegate* delegate); @@ -246,6 +249,9 @@ class ASH_EXPORT Shell { // has the effect of deleting the current LayoutManager. void ResetLayoutManager(int container_id); + // Disables the workspace grid layout. + void DisableWorkspaceGridLayout(); + static Shell* instance_; // Window mode is computed at shell initialization time, so allow it to be diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index db7afd9..1f16bf0 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -288,11 +288,11 @@ TEST_F(ShellTest, IsScreenLocked) { } TEST_F(ShellTest, ComputeWindowMode) { - // By default, we use overlapping mode. + // By default, we use managed mode. Shell* shell = Shell::GetInstance(); Shell::TestApi test_api(shell); CommandLine command_line_blank(CommandLine::NO_PROGRAM); - EXPECT_EQ(Shell::MODE_OVERLAPPING, + EXPECT_EQ(Shell::MODE_MANAGED, test_api.ComputeWindowMode(&command_line_blank)); // Sometimes we force compact mode. @@ -301,6 +301,14 @@ TEST_F(ShellTest, ComputeWindowMode) { EXPECT_EQ(Shell::MODE_COMPACT, test_api.ComputeWindowMode(&command_line_force)); + // The user can set overlapping mode. + CommandLine command_line_overlapping(CommandLine::NO_PROGRAM); + command_line_overlapping.AppendSwitchASCII( + switches::kAuraWindowMode, + switches::kAuraWindowModeOverlapping); + EXPECT_EQ(Shell::MODE_OVERLAPPING, + test_api.ComputeWindowMode(&command_line_overlapping)); + // The user can set compact mode. CommandLine command_line_compact(CommandLine::NO_PROGRAM); command_line_compact.AppendSwitchASCII(switches::kAuraWindowMode, diff --git a/ash/wm/root_window_event_filter_unittest.cc b/ash/wm/root_window_event_filter_unittest.cc index efc2820..baa0408 100644 --- a/ash/wm/root_window_event_filter_unittest.cc +++ b/ash/wm/root_window_event_filter_unittest.cc @@ -351,6 +351,9 @@ TEST_F(RootWindowEventFilterTest, ActivateOnTouch) { TEST_F(RootWindowEventFilterTest, MouseEventCursors) { aura::RootWindow* root_window = Shell::GetRootWindow(); + // Disable ash grid so that test can place a window at + // specific location. + ash::Shell::GetInstance()->DisableWorkspaceGridLayout(); // Create a window. const int kWindowLeft = 123; @@ -414,6 +417,10 @@ TEST_F(RootWindowEventFilterTest, MouseEventCursors) { } TEST_F(RootWindowEventFilterTest, TransformActivate) { + // Disable ash grid so that test can place a window at + // specific location. + ash::Shell::GetInstance()->DisableWorkspaceGridLayout(); + aura::RootWindow* root_window = Shell::GetRootWindow(); gfx::Size size = root_window->GetHostSize(); EXPECT_EQ(gfx::Rect(size), diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc index 43c4ef0..8fe68ca 100644 --- a/ash/wm/workspace/workspace_manager.cc +++ b/ash/wm/workspace/workspace_manager.cc @@ -343,7 +343,7 @@ void WorkspaceManager::SetWindowBoundsFromRestoreBounds(aura::Window* window) { bounds = restore->AdjustToFit(GetWorkAreaBounds()); else bounds = window->bounds().AdjustToFit(GetWorkAreaBounds()); - SetWindowBounds(window, AlignRectToGrid(bounds, grid_size_)); + SetWindowBounds(window, bounds); ash::ClearRestoreBounds(window); } diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc index 5de7be1..16a046b 100644 --- a/chrome/browser/extensions/extension_tabs_apitest.cc +++ b/chrome/browser/extensions/extension_tabs_apitest.cc @@ -29,11 +29,19 @@ #define MAYBE_UpdateWindowResize DISABLED_UpdateWindowResize #define MAYBE_UpdateWindowShowState DISABLED_UpdateWindowShowState #else + +#if defined(USE_AURA) +// Maximizing/fullscreen popup window doesn't work on aura's managed mode. +// See bug crbug.com/116305. +#define MAYBE_UpdateWindowShowState DISABLED_UpdateWindowShowState +#else +#define MAYBE_UpdateWindowShowState UpdateWindowShowState +#endif // defined(USE_AURA) + #define MAYBE_FocusWindowDoesNotExitFullscreen FocusWindowDoesNotExitFullscreen #define MAYBE_UpdateWindowSizeExitsFullscreen UpdateWindowSizeExitsFullscreen #define MAYBE_UpdateWindowResize UpdateWindowResize -#define MAYBE_UpdateWindowShowState UpdateWindowShowState -#endif +#endif // defined(OS_LINUX) && !defined(USE_AURA) IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Tabs) { // The test creates a tab and checks that the URL of the new tab |