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

Unified Diff: ui/aura_shell/laptop_mode_layout_manager.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/laptop_mode_layout_manager.cc
diff --git a/ui/aura_shell/laptop_mode_layout_manager.cc b/ui/aura_shell/laptop_mode_layout_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..33ef5a4d4fd553b8385ce9a22c7b706347fe81b0
--- /dev/null
+++ b/ui/aura_shell/laptop_mode_layout_manager.cc
@@ -0,0 +1,70 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura_shell/laptop_mode_layout_manager.h"
+
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/window.h"
+#include "ui/aura_shell/window_util.h"
+#include "ui/base/ui_base_types.h"
+#include "ui/gfx/screen.h"
+
+namespace aura_shell {
+namespace internal {
+
+LaptopModeLayoutManager::LaptopModeLayoutManager() {
+}
+
+LaptopModeLayoutManager::~LaptopModeLayoutManager() {
+ for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i)
+ (*i)->RemoveObserver(this);
+}
+
+void LaptopModeLayoutManager::OnWindowResized() {
+}
+
+void LaptopModeLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
+ windows_.insert(child);
+ child->AddObserver(this);
+ if (child->GetProperty(aura::kShowStateKey))
+ window_util::UpdateBoundsFromShowState(child);
+}
+
+void LaptopModeLayoutManager::OnWillRemoveWindowFromLayout(
+ aura::Window* child) {
+ windows_.erase(child);
+ child->RemoveObserver(this);
+}
+
+void LaptopModeLayoutManager::OnChildWindowVisibilityChanged(
+ aura::Window* child,
+ bool visibile) {
+}
+
+void LaptopModeLayoutManager::SetChildBounds(
+ aura::Window* child,
+ const gfx::Rect& requested_bounds) {
+ // In laptop mode normal windows always fill the work area.
+ // TODO(jamescook): Make this apply only to tabbed browser windows -- right
+ // now browser popups fill the screen too.
+ if (child->type() == aura::WINDOW_TYPE_NORMAL) {
+ gfx::Rect work_area_bounds =
+ gfx::Screen::GetMonitorWorkAreaNearestWindow(child);
+ if (requested_bounds != work_area_bounds) {
+ child->SetBounds(work_area_bounds);
+ return;
+ }
+ }
+ SetChildBoundsDirect(child, requested_bounds);
+}
+
+void LaptopModeLayoutManager::OnWindowPropertyChanged(aura::Window* window,
+ const char* name,
+ void* old) {
+ if (name == aura::kShowStateKey)
+ window_util::UpdateBoundsFromShowState(window);
+}
+
+} // namespace internal
+} // namespace aura_shell

Powered by Google App Engine
This is Rietveld 408576698