summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell/default_container_layout_manager.cc
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 16:24:10 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 16:24:10 +0000
commit3acf5a57a0f4a68c45838e21bf928ee6760f8390 (patch)
tree595d897349bbc82cc25a3ddcd5c3d4126c315503 /ui/aura_shell/default_container_layout_manager.cc
parent360ded8150e6868e6906e9c19dfcbf9823d2c115 (diff)
downloadchromium_src-3acf5a57a0f4a68c45838e21bf928ee6760f8390.zip
chromium_src-3acf5a57a0f4a68c45838e21bf928ee6760f8390.tar.gz
chromium_src-3acf5a57a0f4a68c45838e21bf928ee6760f8390.tar.bz2
LayoutManager controls child bounds. Added SetChildBounds and several listener methods to LayoutManager class. They will be used to implement more sophisticated behavior.
Implemented DefaultContainerLayoutManager. Added test_support_aura component so that it can be shared between aura and aura_shell. Fixed component build for aura_shell_unittests BUG=none TEST=default_container_layout_manager_unittests. Review URL: http://codereview.chromium.org/8296002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura_shell/default_container_layout_manager.cc')
-rw-r--r--ui/aura_shell/default_container_layout_manager.cc67
1 files changed, 67 insertions, 0 deletions
diff --git a/ui/aura_shell/default_container_layout_manager.cc b/ui/aura_shell/default_container_layout_manager.cc
new file mode 100644
index 0000000..d3c23c3
--- /dev/null
+++ b/ui/aura_shell/default_container_layout_manager.cc
@@ -0,0 +1,67 @@
+// 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/default_container_layout_manager.h"
+
+#include "ui/aura/desktop.h"
+#include "ui/aura/window.h"
+#include "ui/aura/screen_aura.h"
+#include "ui/aura/window_types.h"
+#include "ui/gfx/rect.h"
+
+namespace aura_shell {
+namespace internal {
+
+////////////////////////////////////////////////////////////////////////////////
+// DefaultContainerLayoutManager, public:
+
+DefaultContainerLayoutManager::DefaultContainerLayoutManager(
+ aura::Window* owner)
+ : owner_(owner) {
+}
+
+DefaultContainerLayoutManager::~DefaultContainerLayoutManager() {}
+
+////////////////////////////////////////////////////////////////////////////////
+// DefaultContainerLayoutManager, aura::LayoutManager implementation:
+
+void DefaultContainerLayoutManager::OnWindowResized() {
+ aura::Window::Windows::const_iterator i = owner_->children().begin();
+ // Use SetBounds because window may be maximized or fullscreen.
+ for (; i != owner_->children().end(); ++i)
+ (*i)->SetBounds((*i)->bounds());
+ NOTIMPLEMENTED();
+}
+
+void DefaultContainerLayoutManager::OnWindowAdded(aura::Window* child) {
+ child->SetBounds(child->bounds());
+ NOTIMPLEMENTED();
+}
+
+void DefaultContainerLayoutManager::OnWillRemoveWindow(aura::Window* child) {
+ NOTIMPLEMENTED();
+}
+
+void DefaultContainerLayoutManager::OnChildWindowVisibilityChanged(
+ aura::Window* window, bool visibile) {
+ NOTIMPLEMENTED();
+}
+
+void DefaultContainerLayoutManager::CalculateBoundsForChild(
+ aura::Window* child, gfx::Rect* requested_bounds) {
+ if (child->type() != aura::kWindowType_Toplevel)
+ return;
+ // TODO(oshima): Figure out bounds for default windows.
+ gfx::Rect viewport_bounds = owner_->bounds();
+
+ // A window can still be placed outside of the screen.
+ requested_bounds->SetRect(
+ requested_bounds->x(),
+ viewport_bounds.y(),
+ std::min(requested_bounds->width(), viewport_bounds.width()),
+ std::min(requested_bounds->height(), viewport_bounds.height()));
+}
+
+} // namespace internal
+} // namespace aura_shell