Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: ash/shell.cc

Issue 9316005: Aura: Rework window mode flags to compact/overlapping/managed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with review feedback Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shell.h ('k') | ash/shell_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index c839d5873a9dd327bc868c942040e589380a486d..b3abd0565e5f25cd7d0cbe05ded7b48013973ba9 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -175,7 +175,7 @@ Shell::Shell(ShellDelegate* delegate)
: ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
accelerator_controller_(new AcceleratorController),
delegate_(delegate),
- window_mode_(NORMAL_MODE),
+ window_mode_(MODE_OVERLAPPING),
root_window_layout_(NULL),
status_widget_(NULL) {
aura::RootWindow::GetInstance()->SetEventFilter(
@@ -197,10 +197,8 @@ Shell::~Shell() {
// ShelfLayoutManager has a reference to the launcher widget. To avoid any of
// these trying to reference launcher after it's deleted we delete them all,
// then the launcher.
- if (!CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kAuraWorkspaceManager)) {
+ if (window_mode_ != MODE_MANAGED)
ResetLayoutManager(internal::kShellWindowId_DefaultContainer);
- }
ResetLayoutManager(internal::kShellWindowId_StatusContainer);
ResetLayoutManager(internal::kShellWindowId_LauncherContainer);
// Make sure we delete WorkspaceController before launcher is
@@ -291,10 +289,10 @@ void Shell::Init() {
GetContainer(internal::kShellWindowId_DefaultContainer);
launcher_.reset(new Launcher(default_container));
- if (IsWindowModeCompact())
+ if (window_mode_ == MODE_COMPACT)
SetupCompactWindowMode();
else
- SetupNormalWindowMode();
+ SetupNonCompactWindowMode();
if (!command_line->HasSwitch(switches::kAuraNoShadows))
shadow_controller_.reset(new internal::ShadowController());
@@ -324,30 +322,32 @@ void Shell::Init() {
Shell::WindowMode Shell::ComputeWindowMode(const gfx::Size& monitor_size,
CommandLine* command_line) const {
if (command_line->HasSwitch(switches::kAuraForceCompactWindowMode))
- return COMPACT_MODE;
+ return MODE_COMPACT;
// If user set the flag, use their desired behavior.
if (command_line->HasSwitch(switches::kAuraWindowMode)) {
std::string mode =
command_line->GetSwitchValueASCII(switches::kAuraWindowMode);
- if (mode == switches::kAuraWindowModeNormal)
- return NORMAL_MODE;
if (mode == switches::kAuraWindowModeCompact)
- return COMPACT_MODE;
+ return MODE_COMPACT;
+ if (mode == switches::kAuraWindowModeManaged)
+ return MODE_MANAGED;
+ if (mode == switches::kAuraWindowModeOverlapping)
+ return MODE_OVERLAPPING;
}
// Developers often run the Aura shell in small windows on their desktop.
- // Prefer normal mode for them.
+ // Prefer overlapping mode for them.
if (!aura::RootWindow::use_fullscreen_host_window())
- return NORMAL_MODE;
+ return MODE_OVERLAPPING;
// If the screen is narrow we prefer a single compact window display.
// We explicitly don't care about height, since users don't generally stack
// browser windows vertically.
if (monitor_size.width() <= kCompactWindowModeWidthThreshold)
- return COMPACT_MODE;
+ return MODE_COMPACT;
- return NORMAL_MODE;
+ return MODE_OVERLAPPING;
}
aura::Window* Shell::GetContainer(int container_id) {
@@ -391,10 +391,10 @@ void Shell::ChangeWindowMode(WindowMode mode) {
return;
// Window mode must be set before we resize/layout the windows.
window_mode_ = mode;
- if (window_mode_ == COMPACT_MODE)
+ if (window_mode_ == MODE_COMPACT)
SetupCompactWindowMode();
else
- SetupNormalWindowMode();
+ SetupNonCompactWindowMode();
// Force a layout.
aura::RootWindow::GetInstance()->layout_manager()->OnWindowResized();
}
@@ -463,7 +463,7 @@ void Shell::SetupCompactWindowMode() {
root_window_layout_->SetBackgroundWidget(NULL);
}
-void Shell::SetupNormalWindowMode() {
+void Shell::SetupNonCompactWindowMode() {
DCHECK(root_window_layout_);
DCHECK(status_widget_);
@@ -484,8 +484,7 @@ void Shell::SetupNormalWindowMode() {
aura::Window* default_container =
GetContainer(internal::kShellWindowId_DefaultContainer);
- if (CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kAuraWorkspaceManager)) {
+ if (window_mode_ == MODE_MANAGED) {
// Workspace manager has its own layout managers.
workspace_controller_.reset(
new internal::WorkspaceController(default_container));
« no previous file with comments | « ash/shell.h ('k') | ash/shell_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698