| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/view.h" | 5 #include "ui/views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void View::SetHotTracked(bool flag) { | 98 void View::SetHotTracked(bool flag) { |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool View::IsHotTracked() const { | 101 bool View::IsHotTracked() const { |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Creation and lifetime ------------------------------------------------------- | 105 // Creation and lifetime ------------------------------------------------------- |
| 106 | 106 |
| 107 View::View() | 107 View::View() |
| 108 : parent_owned_(true), | 108 : owned_by_parent_(true), |
| 109 id_(0), | 109 id_(0), |
| 110 group_(-1), | 110 group_(-1), |
| 111 parent_(NULL), | 111 parent_(NULL), |
| 112 visible_(true), | 112 visible_(true), |
| 113 enabled_(true), | 113 enabled_(true), |
| 114 painting_enabled_(true), | 114 painting_enabled_(true), |
| 115 notify_enter_exit_on_child_(false), | 115 notify_enter_exit_on_child_(false), |
| 116 registered_for_visible_bounds_notification_(false), | 116 registered_for_visible_bounds_notification_(false), |
| 117 clip_insets_(0, 0, 0, 0), | 117 clip_insets_(0, 0, 0, 0), |
| 118 needs_layout_(true), | 118 needs_layout_(true), |
| 119 flip_canvas_on_paint_for_rtl_ui_(false), | 119 flip_canvas_on_paint_for_rtl_ui_(false), |
| 120 paint_to_layer_(false), | 120 paint_to_layer_(false), |
| 121 accelerator_registration_delayed_(false), | 121 accelerator_registration_delayed_(false), |
| 122 accelerator_focus_manager_(NULL), | 122 accelerator_focus_manager_(NULL), |
| 123 registered_accelerator_count_(0), | 123 registered_accelerator_count_(0), |
| 124 next_focusable_view_(NULL), | 124 next_focusable_view_(NULL), |
| 125 previous_focusable_view_(NULL), | 125 previous_focusable_view_(NULL), |
| 126 focusable_(false), | 126 focusable_(false), |
| 127 accessibility_focusable_(false), | 127 accessibility_focusable_(false), |
| 128 context_menu_controller_(NULL), | 128 context_menu_controller_(NULL), |
| 129 drag_controller_(NULL) { | 129 drag_controller_(NULL) { |
| 130 } | 130 } |
| 131 | 131 |
| 132 View::~View() { | 132 View::~View() { |
| 133 if (parent_) | 133 if (parent_) |
| 134 parent_->RemoveChildView(this); | 134 parent_->RemoveChildView(this); |
| 135 | 135 |
| 136 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { | 136 for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { |
| 137 (*i)->parent_ = NULL; | 137 (*i)->parent_ = NULL; |
| 138 if ((*i)->parent_owned()) | 138 if ((*i)->owned_by_parent_) |
| 139 delete *i; | 139 delete *i; |
| 140 } | 140 } |
| 141 | 141 |
| 142 #if defined(OS_WIN) | 142 #if defined(OS_WIN) |
| 143 if (native_view_accessibility_win_.get()) | 143 if (native_view_accessibility_win_.get()) |
| 144 native_view_accessibility_win_->set_view(NULL); | 144 native_view_accessibility_win_->set_view(NULL); |
| 145 #endif | 145 #endif |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Tree operations ------------------------------------------------------------- | 148 // Tree operations ------------------------------------------------------------- |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 if (next_focusable) | 1540 if (next_focusable) |
| 1541 next_focusable->previous_focusable_view_ = prev_focusable; | 1541 next_focusable->previous_focusable_view_ = prev_focusable; |
| 1542 } | 1542 } |
| 1543 | 1543 |
| 1544 if (GetWidget()) | 1544 if (GetWidget()) |
| 1545 UnregisterChildrenForVisibleBoundsNotification(view); | 1545 UnregisterChildrenForVisibleBoundsNotification(view); |
| 1546 view->PropagateRemoveNotifications(this); | 1546 view->PropagateRemoveNotifications(this); |
| 1547 view->parent_ = NULL; | 1547 view->parent_ = NULL; |
| 1548 view->UpdateLayerVisibility(); | 1548 view->UpdateLayerVisibility(); |
| 1549 | 1549 |
| 1550 if (delete_removed_view && view->parent_owned()) | 1550 if (delete_removed_view && view->owned_by_parent_) |
| 1551 view_to_be_deleted.reset(view); | 1551 view_to_be_deleted.reset(view); |
| 1552 | 1552 |
| 1553 children_.erase(i); | 1553 children_.erase(i); |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 if (update_tool_tip) | 1556 if (update_tool_tip) |
| 1557 UpdateTooltip(); | 1557 UpdateTooltip(); |
| 1558 | 1558 |
| 1559 if (layout_manager_.get()) | 1559 if (layout_manager_.get()) |
| 1560 layout_manager_->ViewRemoved(this, view); | 1560 layout_manager_->ViewRemoved(this, view); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 | 2072 |
| 2073 // Message the RootView to do the drag and drop. That way if we're removed | 2073 // Message the RootView to do the drag and drop. That way if we're removed |
| 2074 // the RootView can detect it and avoid calling us back. | 2074 // the RootView can detect it and avoid calling us back. |
| 2075 gfx::Point widget_location(event.location()); | 2075 gfx::Point widget_location(event.location()); |
| 2076 ConvertPointToWidget(this, &widget_location); | 2076 ConvertPointToWidget(this, &widget_location); |
| 2077 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2077 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
| 2078 #endif // !defined(OS_MACOSX) | 2078 #endif // !defined(OS_MACOSX) |
| 2079 } | 2079 } |
| 2080 | 2080 |
| 2081 } // namespace views | 2081 } // namespace views |
| OLD | NEW |