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

Unified Diff: mojo/services/view_manager/window_tree_host_impl.cc

Issue 354933002: Connect X11 ConfigureNotify events to Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Syncd with NodeObserver API change Created 6 years, 5 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 | « mojo/services/view_manager/view_manager_service_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/window_tree_host_impl.cc
diff --git a/mojo/services/view_manager/window_tree_host_impl.cc b/mojo/services/view_manager/window_tree_host_impl.cc
index f6ded7f92a95827499501a3e6f13e498b831f12f..810caf85d3f9994c820c1a4a18a2964f1108b4b8 100644
--- a/mojo/services/view_manager/window_tree_host_impl.cc
+++ b/mojo/services/view_manager/window_tree_host_impl.cc
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "mojo/services/view_manager/root_node_manager.h"
#include "mojo/services/view_manager/window_tree_host_impl.h"
-
#include "mojo/public/c/gles2/gles2.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/view_manager/context_factory_impl.h"
#include "ui/aura/env.h"
+#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/compositor.h"
@@ -25,6 +26,47 @@ namespace service {
ContextFactoryImpl* WindowTreeHostImpl::context_factory_ = NULL;
////////////////////////////////////////////////////////////////////////////////
+// RootLayoutManager, layout management for the root window's (one) child
+
+class RootLayoutManager : public aura::LayoutManager {
+ public:
+ RootLayoutManager() : child_(NULL) { }
sky 2014/07/09 21:23:21 nit: {}
+
+ // Overridden from aura::LayoutManager
+ virtual void OnWindowResized() OVERRIDE;
+ virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {}
+ virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {}
+ virtual void OnChildWindowVisibilityChanged(aura::Window* child,
+ bool visible) OVERRIDE {}
+ virtual void SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) OVERRIDE;
+ private:
+ aura::Window* child_;
+
+ DISALLOW_COPY_AND_ASSIGN(RootLayoutManager);
+};
+
+void RootLayoutManager::OnWindowResized() {
+ if (child_) {
+ gfx::Rect bounds = child_->parent()->bounds();
+ child_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height()));
sky 2014/07/09 21:23:22 nit: gfx::Rect(bounds.size()) and nuke 52 so that
+ }
+}
+
+void RootLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
+ DCHECK(!child_);
+ child_ = child;
+}
+
+void RootLayoutManager::SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) {
+ SetChildBoundsDirect(child, gfx::Rect(
+ requested_bounds.width(),
sky 2014/07/09 21:23:22 nit: gfx::Rect(requested_bounds.size())
+ requested_bounds.height()));
+}
+
+////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostImpl, public:
WindowTreeHostImpl::WindowTreeHostImpl(
@@ -48,6 +90,8 @@ WindowTreeHostImpl::WindowTreeHostImpl(
}
context_factory_ = new ContextFactoryImpl(pipe.handle1.Pass());
aura::Env::GetInstance()->set_context_factory(context_factory_);
+
+ window()->SetLayoutManager(new RootLayoutManager());
}
WindowTreeHostImpl::~WindowTreeHostImpl() {
« no previous file with comments | « mojo/services/view_manager/view_manager_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698