summaryrefslogtreecommitdiffstats
path: root/ash/wm/base_layout_manager.h
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 23:57:05 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 23:57:05 +0000
commitfc7b744c639fb4a9c25b1dbf5f7553166fdc1801 (patch)
treee3f486d62831674fddc60d6f05689dad8fba3a55 /ash/wm/base_layout_manager.h
parentae6c59c831e325ea8cd45340e27acd75d5ddc4e5 (diff)
downloadchromium_src-fc7b744c639fb4a9c25b1dbf5f7553166fdc1801.zip
chromium_src-fc7b744c639fb4a9c25b1dbf5f7553166fdc1801.tar.gz
chromium_src-fc7b744c639fb4a9c25b1dbf5f7553166fdc1801.tar.bz2
Aura: Split out CompactLayoutManager from ToplevelLayoutManager
Move the shared code to BaseLayoutManager. Adjust the unit tests. Alice needs this for some compact mode work she's doing right now. BUG=110648 TEST=Run Aura in both --aura-window-mode=normal and --aura-window-mode=compact, both still start correctly. Also unit test coverage from CompactLayoutManagerTest and ToplevelLayoutManagerTest Review URL: https://chromiumcodereview.appspot.com/9255024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/base_layout_manager.h')
-rw-r--r--ash/wm/base_layout_manager.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h
new file mode 100644
index 0000000..4ceb82e
--- /dev/null
+++ b/ash/wm/base_layout_manager.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2012 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.
+
+#ifndef ASH_WM_BASE_LAYOUT_MANAGER_H_
+#define ASH_WM_BASE_LAYOUT_MANAGER_H_
+#pragma once
+
+#include <set>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/aura/layout_manager.h"
+#include "ui/aura/root_window_observer.h"
+#include "ui/aura/window_observer.h"
+#include "ash/ash_export.h"
+
+namespace aura {
+class Window;
+}
+
+namespace ash {
+namespace internal {
+
+// BaseLayoutManager is the simplest possible implementation for a window
+// layout manager. It listens for changes to kShowStateKey and resizes the
+// window appropriately. Subclasses should be sure to invoke the base class
+// for adding and removing windows, otherwise show state will not be tracked
+// properly.
+class ASH_EXPORT BaseLayoutManager : public aura::LayoutManager,
+ public aura::RootWindowObserver,
+ public aura::WindowObserver {
+ public:
+ typedef std::set<aura::Window*> WindowSet;
+
+ BaseLayoutManager();
+ virtual ~BaseLayoutManager();
+
+ const WindowSet& windows() const { return windows_; }
+
+ // LayoutManager overrides:
+ virtual void OnWindowResized() OVERRIDE;
+ virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
+ virtual void OnChildWindowVisibilityChanged(aura::Window* child,
+ bool visibile) OVERRIDE;
+ virtual void SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) OVERRIDE;
+
+ // RootWindowObserver overrides:
+ virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE;
+
+ // WindowObserver overrides:
+ virtual void OnWindowPropertyChanged(aura::Window* window,
+ const char* name,
+ void* old) OVERRIDE;
+
+ private:
+ // Update window bounds based on a change in show state.
+ void UpdateBoundsFromShowState(aura::Window* window);
+
+ // Set of windows we're listening to.
+ WindowSet windows_;
+
+ DISALLOW_COPY_AND_ASSIGN(BaseLayoutManager);
+};
+
+} // namespace ash
+} // namespace internal
+
+#endif // ASH_WM_BASE_LAYOUT_MANAGER_H_