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

Unified Diff: views/widget/root_view.cc

Issue 6452011: Rework tree APIs to reflect Google style and more const-correctness.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « views/widget/root_view.h ('k') | views/window/client_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/root_view.cc
===================================================================
--- views/widget/root_view.cc (revision 74231)
+++ views/widget/root_view.cc (working copy)
@@ -104,7 +104,7 @@
RootView::~RootView() {
// If we have children remove them explicitly so to make sure a remove
// notification is sent for each one of them.
- if (!child_views_.empty())
+ if (has_children())
RemoveAllChildViews(true);
if (pending_paint_task_)
@@ -117,7 +117,7 @@
// The ContentsView must be set up _after_ the window is created so that its
// Widget pointer is valid.
SetLayoutManager(new FillLayout);
- if (GetChildViewCount() != 0)
+ if (has_children())
RemoveAllChildViews(true);
AddChildView(contents_view);
@@ -252,10 +252,14 @@
//
/////////////////////////////////////////////////////////////////////////////
-Widget* RootView::GetWidget() const {
+const Widget* RootView::GetWidget() const {
return widget_;
}
+Widget* RootView::GetWidget() {
+ return const_cast<Widget*>(const_cast<const RootView*>(this)->GetWidget());
+}
+
void RootView::NotifyThemeChanged() {
View::PropagateThemeChanged();
}
@@ -332,7 +336,7 @@
// Walk up the tree until we find a view that wants the touch event.
for (touch_pressed_handler_ = GetViewForPoint(e.location());
touch_pressed_handler_ && (touch_pressed_handler_ != this);
- touch_pressed_handler_ = touch_pressed_handler_->GetParent()) {
+ touch_pressed_handler_ = touch_pressed_handler_->parent()) {
if (!touch_pressed_handler_->IsEnabled()) {
// Disabled views eat events but are treated as not handled by the
// the GestureManager.
@@ -407,7 +411,7 @@
// Walk up the tree until we find a view that wants the mouse event.
for (mouse_pressed_handler_ = GetViewForPoint(e.location());
mouse_pressed_handler_ && (mouse_pressed_handler_ != this);
- mouse_pressed_handler_ = mouse_pressed_handler_->GetParent()) {
+ mouse_pressed_handler_ = mouse_pressed_handler_->parent()) {
if (!mouse_pressed_handler_->IsEnabled()) {
// Disabled views should eat events instead of propagating them upwards.
hit_disabled_view = true;
@@ -547,7 +551,7 @@
// disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED
// and ET_MOUSE_ENTERED events, because the mouse hasn't actually exited yet.
while (v && !v->IsEnabled() && (v != mouse_move_handler_))
- v = v->GetParent();
+ v = v->parent();
if (v && v != this) {
if (v != mouse_move_handler_) {
if (mouse_move_handler_ != NULL) {
@@ -681,7 +685,7 @@
v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false);
return true;
}
- for (; v && v != this && !consumed; v = v->GetParent()) {
+ for (; v && v != this && !consumed; v = v->parent()) {
consumed = (event.GetType() == Event::ET_KEY_PRESSED) ?
v->OnKeyPressed(event) : v->OnKeyReleased(event);
}
@@ -699,10 +703,8 @@
View* v;
bool consumed = false;
if (GetFocusedView()) {
- for (v = GetFocusedView();
- v && v != this && !consumed; v = v->GetParent()) {
+ for (v = GetFocusedView(); v && v != this && !consumed; v = v->parent())
consumed = v->OnMouseWheel(e);
- }
}
if (!consumed && default_keyboard_handler_) {
@@ -736,10 +738,10 @@
if (view->registered_for_visible_bounds_notification_)
return;
view->registered_for_visible_bounds_notification_ = true;
- View* ancestor = view->GetParent();
+ View* ancestor = view->parent();
while (ancestor) {
ancestor->AddDescendantToNotify(view);
- ancestor = ancestor->GetParent();
+ ancestor = ancestor->parent();
}
}
@@ -748,10 +750,10 @@
if (!view->registered_for_visible_bounds_notification_)
return;
view->registered_for_visible_bounds_notification_ = false;
- View* ancestor = view->GetParent();
+ View* ancestor = view->parent();
while (ancestor) {
ancestor->RemoveDescendantToNotify(view);
- ancestor = ancestor->GetParent();
+ ancestor = ancestor->parent();
}
}
« no previous file with comments | « views/widget/root_view.h ('k') | views/window/client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698