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

Unified Diff: ui/aura_shell/shell.cc

Issue 8895003: Aura: Add --aura-laptop-mode to fill the workspace with a single window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maximize ALL the windows Created 9 years 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
Index: ui/aura_shell/shell.cc
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc
index 406215edf0c8b29e878f604d4eda60f520fb529d..092600ba6eadc812f5528ffaecdc8e57be3f5bc0 100644
--- a/ui/aura_shell/shell.cc
+++ b/ui/aura_shell/shell.cc
@@ -19,6 +19,7 @@
#include "ui/aura_shell/root_window_event_filter.h"
#include "ui/aura_shell/root_window_layout_manager.h"
#include "ui/aura_shell/drag_drop_controller.h"
+#include "ui/aura_shell/laptop_mode_layout_manager.h"
#include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/modal_container_layout_manager.h"
#include "ui/aura_shell/shadow_controller.h"
@@ -192,22 +193,59 @@ void Shell::Init() {
root_window->stacking_client());
stacking_controller->Init();
+ InitLayoutManagers(root_window);
+
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows))
+ shadow_controller_.reset(new internal::ShadowController());
+
+ // Force a layout.
+ root_window->layout_manager()->OnWindowResized();
+
+ // Initialize ShellAcceleratorFilter
+ accelerator_filter_.reset(new internal::ShellAcceleratorFilter);
+ AddRootWindowEventFilter(accelerator_filter_.get());
+
+ // Initialize ShellTooltipManager
+ tooltip_manager_.reset(new ShellTooltipManager);
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowTooltipClientKey,
+ static_cast<aura::TooltipClient*>(tooltip_manager_.get()));
+ AddRootWindowEventFilter(tooltip_manager_.get());
+
+ // Initialize drag drop controller.
+ drag_drop_controller_.reset(new internal::DragDropController);
+ aura::RootWindow::GetInstance()->SetProperty(
+ aura::kRootWindowDragDropClientKey,
+ static_cast<aura::DragDropClient*>(drag_drop_controller_.get()));
+}
+
+void Shell::InitLayoutManagers(aura::RootWindow* root_window) {
internal::RootWindowLayoutManager* root_window_layout =
new internal::RootWindowLayoutManager(root_window);
root_window->SetLayoutManager(root_window_layout);
- root_window_layout->set_background_widget(
- internal::CreateDesktopBackground());
- aura::Window* default_container =
- GetContainer(internal::kShellWindowId_DefaultContainer);
- launcher_.reset(new Launcher(default_container));
-
views::Widget* status_widget = NULL;
if (delegate_.get())
status_widget = delegate_->CreateStatusArea();
if (!status_widget)
status_widget = internal::CreateStatusArea();
+ aura::Window* default_container =
+ GetContainer(internal::kShellWindowId_DefaultContainer);
+
+ // Laptop mode has a simplified layout manager and doesn't use the launcher,
+ // desktop background, shelf, etc.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraLaptopMode)) {
+ default_container->SetLayoutManager(
+ new internal::LaptopModeLayoutManager());
+ // TODO(jamescook): Adjust status area layout.
+ return;
+ }
+
+ root_window_layout->set_background_widget(
+ internal::CreateDesktopBackground());
+ launcher_.reset(new Launcher(default_container));
+
internal::ShelfLayoutManager* shelf_layout_manager =
new internal::ShelfLayoutManager(launcher_->widget(), status_widget);
GetContainer(aura_shell::internal::kShellWindowId_LauncherContainer)->
@@ -218,37 +256,17 @@ void Shell::Init() {
GetContainer(aura_shell::internal::kShellWindowId_StatusContainer)->
SetLayoutManager(status_area_layout_manager);
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows))
- shadow_controller_.reset(new internal::ShadowController());
-
+ // Workspace manager has its own layout managers.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraWindows)) {
EnableWorkspaceManager();
- } else {
- internal::ToplevelLayoutManager* toplevel_layout_manager =
- new internal::ToplevelLayoutManager();
- default_container->SetLayoutManager(toplevel_layout_manager);
- toplevel_layout_manager->set_shelf(shelf_layout_manager);
+ return;
}
- // Force a layout.
- root_window_layout->OnWindowResized();
-
- // Initialize ShellAcceleratorFilter
- accelerator_filter_.reset(new internal::ShellAcceleratorFilter);
- AddRootWindowEventFilter(accelerator_filter_.get());
-
- // Initialize ShellTooltipManager
- tooltip_manager_.reset(new ShellTooltipManager);
- aura::RootWindow::GetInstance()->SetProperty(
- aura::kRootWindowTooltipClientKey,
- static_cast<aura::TooltipClient*>(tooltip_manager_.get()));
- AddRootWindowEventFilter(tooltip_manager_.get());
-
- // Initialize drag drop controller.
- drag_drop_controller_.reset(new internal::DragDropController);
- aura::RootWindow::GetInstance()->SetProperty(
- aura::kRootWindowDragDropClientKey,
- static_cast<aura::DragDropClient*>(drag_drop_controller_.get()));
+ // Default layout manager.
+ internal::ToplevelLayoutManager* toplevel_layout_manager =
+ new internal::ToplevelLayoutManager();
+ default_container->SetLayoutManager(toplevel_layout_manager);
+ toplevel_layout_manager->set_shelf(shelf_layout_manager);
}
aura::Window* Shell::GetContainer(int container_id) {

Powered by Google App Engine
This is Rietveld 408576698