Skip to content

Commit

Permalink
Aura: Remove overlapping window mode
Browse files Browse the repository at this point in the history
We're going with "managed" window mode.  Oshima made it the default last week and updated the tests, so this just removes the unused mode.  I also removed Shell::set_compact_window_mode_for_test() in favor of using ShellDelegate::GetOverrideWindowMode() for the one test that needs compact mode.

BUG=116614
TEST=aura_shell_unittests

Review URL: https://chromiumcodereview.appspot.com/9600006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124961 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jamescook@chromium.org committed Mar 5, 2012
1 parent 91cd5be commit fa0c3f2
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 84 deletions.
3 changes: 0 additions & 3 deletions ash/ash_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ const char kAuraWindowModeCompact[] = "compact";
// windows.
const char kAuraWindowModeManaged[] = "managed";

// Traditional window management with multiple draggable windows.
const char kAuraWindowModeOverlapping[] = "overlapping";

// Use Aura to manage windows of type WINDOW_TYPE_PANEL.
const char kAuraPanelManager[] = "aura-panels";

Expand Down
1 change: 0 additions & 1 deletion ash/ash_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ ASH_EXPORT extern const char kAuraWindowAnimationsDisabled[];
ASH_EXPORT extern const char kAuraWindowMode[];
ASH_EXPORT extern const char kAuraWindowModeCompact[];
ASH_EXPORT extern const char kAuraWindowModeManaged[];
ASH_EXPORT extern const char kAuraWindowModeOverlapping[];
ASH_EXPORT extern const char kAuraPanelManager[];

} // namespace switches
Expand Down
30 changes: 7 additions & 23 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
// static
Shell* Shell::instance_ = NULL;
// static
bool Shell::compact_window_mode_for_test_ = false;
// static
bool Shell::initially_hide_cursor_ = false;

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -452,7 +450,7 @@ void Shell::Init() {
if (window_mode_ == MODE_COMPACT)
SetupCompactWindowMode();
else
SetupNonCompactWindowMode();
SetupManagedWindowMode();

if (!command_line->HasSwitch(switches::kAuraNoShadows))
shadow_controller_.reset(new internal::ShadowController());
Expand Down Expand Up @@ -480,9 +478,6 @@ void Shell::Init() {
}

Shell::WindowMode Shell::ComputeWindowMode(CommandLine* command_line) const {
if (compact_window_mode_for_test_)
return MODE_COMPACT;

// Some devices don't perform well with overlapping windows.
if (command_line->HasSwitch(switches::kAuraForceCompactWindowMode))
return MODE_COMPACT;
Expand All @@ -495,8 +490,6 @@ Shell::WindowMode Shell::ComputeWindowMode(CommandLine* command_line) const {
return MODE_COMPACT;
if (mode == switches::kAuraWindowModeManaged)
return MODE_MANAGED;
if (mode == switches::kAuraWindowModeOverlapping)
return MODE_OVERLAPPING;
}

// Managed is the default.
Expand Down Expand Up @@ -633,7 +626,7 @@ void Shell::SetupCompactWindowMode() {
SetDesktopBackgroundMode(BACKGROUND_SOLID_COLOR);
}

void Shell::SetupNonCompactWindowMode() {
void Shell::SetupManagedWindowMode() {
DCHECK(root_window_layout_);
DCHECK(status_widget_);

Expand All @@ -650,20 +643,11 @@ void Shell::SetupNonCompactWindowMode() {

aura::Window* default_container =
GetContainer(internal::kShellWindowId_DefaultContainer);
if (window_mode_ == MODE_MANAGED) {
// Workspace manager has its own layout managers.
workspace_controller_.reset(
new internal::WorkspaceController(default_container));
workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager);
} else {
// Default layout manager.
internal::ToplevelLayoutManager* toplevel_layout_manager =
new internal::ToplevelLayoutManager();
toplevel_layout_manager->set_shelf(shelf_layout_manager);
default_container->SetLayoutManager(toplevel_layout_manager);
default_container->SetEventFilter(
new ToplevelWindowEventFilter(default_container));
}
// Workspace manager has its own layout managers.
workspace_controller_.reset(
new internal::WorkspaceController(default_container));
workspace_controller_->workspace_manager()->set_shelf(shelf_layout_manager);

// Ensure launcher is visible.
launcher_->widget()->Show();

Expand Down
18 changes: 4 additions & 14 deletions ash/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ class WorkspaceController;
class ASH_EXPORT Shell {
public:
// In compact window mode we fill the screen with a single maximized window,
// similar to ChromeOS R17 and earlier. In overlapping mode we have draggable
// windows. In managed mode the workspace arranges windows for the user.
// similar to ChromeOS R17 and earlier. In managed mode we have overlapping
// windows arranged by the workspace.
enum WindowMode {
MODE_COMPACT,
MODE_MANAGED,
MODE_OVERLAPPING,
};

enum BackgroundMode {
Expand Down Expand Up @@ -221,10 +220,6 @@ class ASH_EXPORT Shell {
return shadow_controller_.get();
}

static void set_compact_window_mode_for_test(bool compact) {
compact_window_mode_for_test_ = compact;
}

private:
FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors);
FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate);
Expand All @@ -236,14 +231,13 @@ class ASH_EXPORT Shell {

void Init();

// Returns the appropriate window mode to use based on the |command_line|
// and |compact_window_mode_for_test_|.
// Returns the appropriate window mode to use based on the |command_line|.
WindowMode ComputeWindowMode(CommandLine* command_line) const;

// Initializes or re-initializes the layout managers and event filters needed
// to support a given window mode and cleans up the unneeded ones.
void SetupCompactWindowMode();
void SetupNonCompactWindowMode();
void SetupManagedWindowMode();

// Sets the LayoutManager of the container with the specified id to NULL. This
// has the effect of deleting the current LayoutManager.
Expand All @@ -254,10 +248,6 @@ class ASH_EXPORT Shell {

static Shell* instance_;

// Window mode is computed at shell initialization time, so allow it to be
// overridden without modifying the global command line.
static bool compact_window_mode_for_test_;

// If set before the Shell is initialized, the mouse cursor will be hidden
// when the screen is initially created.
static bool initially_hide_cursor_;
Expand Down
32 changes: 9 additions & 23 deletions ash/shell_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,6 @@ 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,
Expand All @@ -326,11 +318,11 @@ TEST_F(ShellTest, ComputeWindowMode) {

// Fails on Mac, see http://crbug.com/115662
#if defined(OS_MACOSX)
#define MAYBE_OverlappingWindowModeBasics FAILS_OverlappingWindowModeBasics
#define MAYBE_ManagedWindowModeBasics FAILS_ManagedWindowModeBasics
#else
#define MAYBE_OverlappingWindowModeBasics OverlappingWindowModeBasics
#define MAYBE_ManagedWindowModeBasics ManagedWindowModeBasics
#endif
TEST_F(ShellTest, MAYBE_OverlappingWindowModeBasics) {
TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
Shell* shell = Shell::GetInstance();
Shell::TestApi test_api(shell);

Expand Down Expand Up @@ -389,23 +381,17 @@ TEST_F(ShellTest, FullscreenWindowHidesShelf) {
widget->Close();
}

// Window mode is computed at Shell initialization time. Rather than changing
// the global command line to select compact mode we set a switch before
// initializing the shell.
// By implementing GetOverrideWindowMode we make the Shell come up in compact
// window mode.
class ShellCompactWindowModeTest : public test::AshTestBase {
public:
ShellCompactWindowModeTest() {}
virtual ~ShellCompactWindowModeTest() {}

virtual void SetUp() OVERRIDE {
// Must set this before base class initializes the shell.
Shell::set_compact_window_mode_for_test(true);
test::AshTestBase::SetUp();
}

virtual void TearDown() OVERRIDE {
test::AshTestBase::TearDown();
Shell::set_compact_window_mode_for_test(false);
protected:
virtual bool GetOverrideWindowMode(Shell::WindowMode* window_mode) {
*window_mode = Shell::MODE_COMPACT;
return true;
}

private:
Expand Down
2 changes: 1 addition & 1 deletion ash/test/ash_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AshTestBase::~AshTestBase() {
void AshTestBase::SetUp() {
// Creates Shell and hook with Desktop.
TestShellDelegate* delegate = new TestShellDelegate;
Shell::WindowMode window_mode = Shell::MODE_OVERLAPPING;
Shell::WindowMode window_mode = Shell::MODE_MANAGED;
if (GetOverrideWindowMode(&window_mode))
delegate->SetOverrideWindowMode(window_mode);
ash::Shell::CreateInstance(delegate);
Expand Down
2 changes: 1 addition & 1 deletion ash/test/test_shell_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace test {

TestShellDelegate::TestShellDelegate()
: override_window_mode_(false),
window_mode_(Shell::MODE_OVERLAPPING) {
window_mode_(Shell::MODE_MANAGED) {
}

TestShellDelegate::~TestShellDelegate() {
Expand Down
3 changes: 3 additions & 0 deletions ash/wm/toplevel_layout_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class ShelfLayoutManager;
// compact window mode is not enabled. It is intended to implement the simplest
// possible window management code. If you have a more complex window mode
// please implement a new LayoutManager for it.
//
// TODO(jamescook): If we're happy with managed window mode, this class and
// its tests can be deleted.
class ASH_EXPORT ToplevelLayoutManager : public BaseLayoutManager {
public:
ToplevelLayoutManager();
Expand Down
6 changes: 0 additions & 6 deletions ash/wm/workspace/workspace_event_filter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ class WorkspaceEventFilterTest : public test::AshTestBase {
}

private:
// Overridden from test::AshTestBase:
virtual bool GetOverrideWindowMode(Shell::WindowMode* window_mode) OVERRIDE {
*window_mode = Shell::MODE_MANAGED;
return true;
}

DISALLOW_COPY_AND_ASSIGN(WorkspaceEventFilterTest);
};

Expand Down
5 changes: 0 additions & 5 deletions ash/wm/workspace/workspace_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ class WorkspaceManagerTest : public test::AshTestBase {
internal::WorkspaceManager* manager_;

private:
virtual bool GetOverrideWindowMode(Shell::WindowMode* window_mode) OVERRIDE {
*window_mode = Shell::MODE_MANAGED;
return true;
}

scoped_ptr<internal::ActivationController> activation_controller_;

DISALLOW_COPY_AND_ASSIGN(WorkspaceManagerTest);
Expand Down
5 changes: 1 addition & 4 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -5098,7 +5098,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
Window mode
</message>
<message name="IDS_FLAGS_AURA_WINDOW_MODE_DESCRIPTION" desc="Description for the flag to choose how windows are displayed.">
Compact mode shows a single maximized window, useful for low-resolution devices such as laptops. Managed mode automatically arranges windows. Overlapping window mode shows traditional draggable windows.
Compact mode shows a single maximized window, useful for low-resolution devices such as laptops. Managed mode automatically arranges windows.
</message>
<message name="IDS_FLAGS_AURA_WINDOW_MODE_AUTOMATIC" desc="Option name for automatic selection of window display mode.">
Automatic
Expand All @@ -5109,9 +5109,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_AURA_WINDOW_MODE_MANAGED" desc="Option name for automatically managed window display mode.">
Managed
</message>
<message name="IDS_FLAGS_AURA_WINDOW_MODE_OVERLAPPING" desc="Option name for overlapping window display mode.">
Overlapping
</message>
<message name="IDS_FLAGS_ENABLE_PLATFORM_APPS_NAME" desc="Title for the flag to enable platform apps.">
Enable platform apps
</message>
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ const Experiment::Choice kAuraWindowModeChoices[] = {
{ IDS_FLAGS_AURA_WINDOW_MODE_MANAGED,
ash::switches::kAuraWindowMode,
ash::switches::kAuraWindowModeManaged },
{ IDS_FLAGS_AURA_WINDOW_MODE_OVERLAPPING,
ash::switches::kAuraWindowMode,
ash::switches::kAuraWindowModeOverlapping },
};
#endif

Expand Down

0 comments on commit fa0c3f2

Please sign in to comment.