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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_tree_node.cc

Issue 311423003: Provide an API to the example window manager app that supports closing a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" 5 #include "mojo/services/public/cpp/view_manager/view_tree_node.h"
6 6
7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h"
8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h" 8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" 9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h"
10 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h" 10 #include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 //////////////////////////////////////////////////////////////////////////////// 279 ////////////////////////////////////////////////////////////////////////////////
280 // ViewTreeNode, protected: 280 // ViewTreeNode, protected:
281 281
282 ViewTreeNode::ViewTreeNode() 282 ViewTreeNode::ViewTreeNode()
283 : manager_(NULL), 283 : manager_(NULL),
284 id_(-1), 284 id_(-1),
285 parent_(NULL), 285 parent_(NULL),
286 active_view_(NULL) {} 286 active_view_(NULL) {}
287 287
288 ViewTreeNode::~ViewTreeNode() { 288 ViewTreeNode::~ViewTreeNode() {
289 ScopedDestructionNotifier notifier(this); 289 {
290 if (parent_) 290 // TODO(beng): I'm not sure I like these scoped destruction notifiers.
291 parent_->LocalRemoveChild(this); 291 // When they fall out of scope |this| is toast.
292 if (manager_) 292 ScopedDestructionNotifier notifier(this);
293 ViewManagerPrivate(manager_).RemoveNode(id_); 293 if (parent_)
294 parent_->LocalRemoveChild(this);
295 if (manager_)
296 ViewManagerPrivate(manager_).RemoveNode(id_);
297 }
294 } 298 }
295 299
296 //////////////////////////////////////////////////////////////////////////////// 300 ////////////////////////////////////////////////////////////////////////////////
297 // ViewTreeNode, private: 301 // ViewTreeNode, private:
298 302
299 ViewTreeNode::ViewTreeNode(ViewManager* manager) 303 ViewTreeNode::ViewTreeNode(ViewManager* manager)
300 : manager_(manager), 304 : manager_(manager),
301 id_(ViewManagerPrivate(manager).synchronizer()->CreateViewTreeNode()), 305 id_(ViewManagerPrivate(manager).synchronizer()->CreateViewTreeNode()),
302 parent_(NULL), 306 parent_(NULL),
303 active_view_(NULL) {} 307 active_view_(NULL) {}
(...skipping 28 matching lines...) Expand all
332 void ViewTreeNode::LocalSetBounds(const gfx::Rect& old_bounds, 336 void ViewTreeNode::LocalSetBounds(const gfx::Rect& old_bounds,
333 const gfx::Rect& new_bounds) { 337 const gfx::Rect& new_bounds) {
334 DCHECK(old_bounds == bounds_); 338 DCHECK(old_bounds == bounds_);
335 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); 339 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds);
336 bounds_ = new_bounds; 340 bounds_ = new_bounds;
337 } 341 }
338 342
339 } // namespace view_manager 343 } // namespace view_manager
340 } // namespace mojo 344 } // namespace mojo
341 345
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698