| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #ifndef NDEBUG | 8 #ifndef NDEBUG |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/scoped_ptr.h" |
| 14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 15 #include "gfx/canvas_skia.h" | 16 #include "gfx/canvas_skia.h" |
| 16 #include "gfx/path.h" | 17 #include "gfx/path.h" |
| 17 #include "third_party/skia/include/core/SkShader.h" | 18 #include "third_party/skia/include/core/SkShader.h" |
| 18 #include "ui/base/dragdrop/drag_drop_types.h" | 19 #include "ui/base/dragdrop/drag_drop_types.h" |
| 19 #include "views/background.h" | 20 #include "views/background.h" |
| 20 #include "views/layout_manager.h" | 21 #include "views/layout_manager.h" |
| 21 #include "views/views_delegate.h" | 22 #include "views/views_delegate.h" |
| 22 #include "views/widget/root_view.h" | 23 #include "views/widget/root_view.h" |
| 23 #include "views/widget/tooltip_manager.h" | 24 #include "views/widget/tooltip_manager.h" |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 bool delete_removed_view) { | 625 bool delete_removed_view) { |
| 625 #ifndef NDEBUG | 626 #ifndef NDEBUG |
| 626 DCHECK(!IsProcessingPaint()) << "Should not be removing a child view " << | 627 DCHECK(!IsProcessingPaint()) << "Should not be removing a child view " << |
| 627 "during a paint, this will seriously " << | 628 "during a paint, this will seriously " << |
| 628 "mess things up!"; | 629 "mess things up!"; |
| 629 #endif | 630 #endif |
| 630 DCHECK(a_view); | 631 DCHECK(a_view); |
| 631 const ViewList::iterator i = find(child_views_.begin(), | 632 const ViewList::iterator i = find(child_views_.begin(), |
| 632 child_views_.end(), | 633 child_views_.end(), |
| 633 a_view); | 634 a_view); |
| 635 scoped_ptr<View> view_to_be_deleted; |
| 634 if (i != child_views_.end()) { | 636 if (i != child_views_.end()) { |
| 635 if (update_focus_cycle) { | 637 if (update_focus_cycle) { |
| 636 // Let's remove the view from the focus traversal. | 638 // Let's remove the view from the focus traversal. |
| 637 View* next_focusable = a_view->next_focusable_view_; | 639 View* next_focusable = a_view->next_focusable_view_; |
| 638 View* prev_focusable = a_view->previous_focusable_view_; | 640 View* prev_focusable = a_view->previous_focusable_view_; |
| 639 if (prev_focusable) | 641 if (prev_focusable) |
| 640 prev_focusable->next_focusable_view_ = next_focusable; | 642 prev_focusable->next_focusable_view_ = next_focusable; |
| 641 if (next_focusable) | 643 if (next_focusable) |
| 642 next_focusable->previous_focusable_view_ = prev_focusable; | 644 next_focusable->previous_focusable_view_ = prev_focusable; |
| 643 } | 645 } |
| 644 | 646 |
| 645 RootView* root = GetRootView(); | 647 RootView* root = GetRootView(); |
| 646 if (root) | 648 if (root) |
| 647 UnregisterChildrenForVisibleBoundsNotification(root, a_view); | 649 UnregisterChildrenForVisibleBoundsNotification(root, a_view); |
| 648 a_view->PropagateRemoveNotifications(this); | 650 a_view->PropagateRemoveNotifications(this); |
| 649 a_view->SetParent(NULL); | 651 a_view->SetParent(NULL); |
| 650 | 652 |
| 651 if (delete_removed_view && a_view->IsParentOwned()) | 653 if (delete_removed_view && a_view->IsParentOwned()) |
| 652 delete a_view; | 654 view_to_be_deleted.reset(a_view); |
| 653 | 655 |
| 654 child_views_.erase(i); | 656 child_views_.erase(i); |
| 655 } | 657 } |
| 656 | 658 |
| 657 if (update_tool_tip) | 659 if (update_tool_tip) |
| 658 UpdateTooltip(); | 660 UpdateTooltip(); |
| 659 | 661 |
| 660 if (layout_manager_.get()) | 662 if (layout_manager_.get()) |
| 661 layout_manager_->ViewRemoved(this, a_view); | 663 layout_manager_->ViewRemoved(this, a_view); |
| 662 } | 664 } |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 possible_drag = false; | 1532 possible_drag = false; |
| 1531 start_pt = gfx::Point(); | 1533 start_pt = gfx::Point(); |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 void View::DragInfo::PossibleDrag(const gfx::Point& p) { | 1536 void View::DragInfo::PossibleDrag(const gfx::Point& p) { |
| 1535 possible_drag = true; | 1537 possible_drag = true; |
| 1536 start_pt = p; | 1538 start_pt = p; |
| 1537 } | 1539 } |
| 1538 | 1540 |
| 1539 } // namespace | 1541 } // namespace |
| OLD | NEW |