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

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

Issue 267293004: Wires up view manager to an actual display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 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/node.h ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/node.cc
diff --git a/mojo/services/view_manager/node.cc b/mojo/services/view_manager/node.cc
index e2436dab5aeb96d5f46149465355e37299d2ac54..5f5af519c98379890f9c23ed5fa68803c80559fa 100644
--- a/mojo/services/view_manager/node.cc
+++ b/mojo/services/view_manager/node.cc
@@ -7,6 +7,11 @@
#include "mojo/services/view_manager/node_delegate.h"
#include "mojo/services/view_manager/view.h"
#include "ui/aura/window_property.h"
+#include "ui/base/cursor/cursor.h"
+#include "ui/base/hit_test.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/native_widget_types.h"
DECLARE_WINDOW_PROPERTY_TYPE(mojo::services::view_manager::Node*);
@@ -20,11 +25,15 @@ Node::Node(NodeDelegate* delegate, const NodeId& id)
: delegate_(delegate),
id_(id),
view_(NULL),
- window_(NULL) {
+ window_(this) {
DCHECK(delegate); // Must provide a delegate.
window_.set_owned_by_parent(false);
window_.AddObserver(this);
window_.SetProperty(kNodeKey, this);
+ window_.Init(aura::WINDOW_LAYER_TEXTURED);
+
+ // TODO(sky): this likely needs to be false and add a visibility API.
+ window_.Show();
}
Node::~Node() {
@@ -80,14 +89,73 @@ void Node::OnWindowHierarchyChanged(
if (params.target != &window_ || params.receiver != &window_)
return;
NodeId new_parent_id;
- if (params.new_parent)
+ if (params.new_parent && params.new_parent->GetProperty(kNodeKey))
new_parent_id = params.new_parent->GetProperty(kNodeKey)->id();
NodeId old_parent_id;
- if (params.old_parent)
+ if (params.old_parent && params.old_parent->GetProperty(kNodeKey))
old_parent_id = params.old_parent->GetProperty(kNodeKey)->id();
delegate_->OnNodeHierarchyChanged(id_, new_parent_id, old_parent_id);
}
+gfx::Size Node::GetMinimumSize() const {
+ return gfx::Size();
+}
+
+gfx::Size Node::GetMaximumSize() const {
+ return gfx::Size();
+}
+
+void Node::OnBoundsChanged(const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+}
+
+gfx::NativeCursor Node::GetCursor(const gfx::Point& point) {
+ return gfx::kNullCursor;
+}
+
+int Node::GetNonClientComponent(const gfx::Point& point) const {
+ return HTCAPTION;
+}
+
+bool Node::ShouldDescendIntoChildForEventHandling(
+ aura::Window* child,
+ const gfx::Point& location) {
+ return true;
+}
+
+bool Node::CanFocus() {
+ return true;
+}
+
+void Node::OnCaptureLost() {
+}
+
+void Node::OnPaint(gfx::Canvas* canvas) {
+ if (view_) {
+ canvas->DrawImageInt(
+ gfx::ImageSkia::CreateFrom1xBitmap(view_->bitmap()), 0, 0);
+ }
+}
+
+void Node::OnDeviceScaleFactorChanged(float device_scale_factor) {
+}
+
+void Node::OnWindowDestroying(aura::Window* window) {
+}
+
+void Node::OnWindowDestroyed(aura::Window* window) {
+}
+
+void Node::OnWindowTargetVisibilityChanged(bool visible) {
+}
+
+bool Node::HasHitTestMask() const {
+ return false;
+}
+
+void Node::GetHitTestMask(gfx::Path* mask) const {
+}
+
} // namespace view_manager
} // namespace services
} // namespace mojo
« no previous file with comments | « mojo/services/view_manager/node.h ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698