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

Side by Side Diff: views/view.cc

Issue 7111008: views: Use ViewVector typedef instead of std::vector<View*> in view.* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
« no previous file with comments | « views/view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 } 559 }
560 560
561 int View::GetGroup() const { 561 int View::GetGroup() const {
562 return group_; 562 return group_;
563 } 563 }
564 564
565 bool View::IsGroupFocusTraversable() const { 565 bool View::IsGroupFocusTraversable() const {
566 return true; 566 return true;
567 } 567 }
568 568
569 void View::GetViewsWithGroup(int group_id, std::vector<View*>* out) { 569 void View::GetViewsWithGroup(int group_id, ViewVector* out) {
570 if (group_ == group_id) 570 if (group_ == group_id)
571 out->push_back(this); 571 out->push_back(this);
572 572
573 for (int i = 0, count = child_count(); i < count; ++i) 573 for (int i = 0, count = child_count(); i < count; ++i)
574 GetChildViewAt(i)->GetViewsWithGroup(group_id, out); 574 GetChildViewAt(i)->GetViewsWithGroup(group_id, out);
575 } 575 }
576 576
577 View* View::GetSelectedViewForGroup(int group_id) { 577 View* View::GetSelectedViewForGroup(int group_id) {
578 std::vector<View*> views; 578 ViewVector views;
579 GetWidget()->GetRootView()->GetViewsWithGroup(group_id, &views); 579 GetWidget()->GetRootView()->GetViewsWithGroup(group_id, &views);
580 return views.empty() ? NULL : views[0]; 580 return views.empty() ? NULL : views[0];
581 } 581 }
582 582
583 // Coordinate conversion ------------------------------------------------------- 583 // Coordinate conversion -------------------------------------------------------
584 584
585 // static 585 // static
586 void View::ConvertPointToView(const View* src, 586 void View::ConvertPointToView(const View* src,
587 const View* dst, 587 const View* dst,
588 gfx::Point* point) { 588 gfx::Point* point) {
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 Layout(); 1456 Layout();
1457 } 1457 }
1458 1458
1459 if (NeedsNotificationWhenVisibleBoundsChange()) { 1459 if (NeedsNotificationWhenVisibleBoundsChange()) {
1460 OnVisibleBoundsChanged(); 1460 OnVisibleBoundsChanged();
1461 } 1461 }
1462 1462
1463 // Notify interested Views that visible bounds within the root view may have 1463 // Notify interested Views that visible bounds within the root view may have
1464 // changed. 1464 // changed.
1465 if (descendants_to_notify_.get()) { 1465 if (descendants_to_notify_.get()) {
1466 for (std::vector<View*>::iterator i = descendants_to_notify_->begin(); 1466 for (ViewVector::iterator i = descendants_to_notify_->begin();
1467 i != descendants_to_notify_->end(); ++i) { 1467 i != descendants_to_notify_->end(); ++i) {
1468 (*i)->OnVisibleBoundsChanged(); 1468 (*i)->OnVisibleBoundsChanged();
1469 } 1469 }
1470 } 1470 }
1471 } 1471 }
1472 1472
1473 // static 1473 // static
1474 void View::RegisterChildrenForVisibleBoundsNotification(View* view) { 1474 void View::RegisterChildrenForVisibleBoundsNotification(View* view) {
1475 if (view->NeedsNotificationWhenVisibleBoundsChange()) 1475 if (view->NeedsNotificationWhenVisibleBoundsChange())
1476 view->RegisterForVisibleBoundsNotification(); 1476 view->RegisterForVisibleBoundsNotification();
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 1737
1738 if (child_count == 0) { 1738 if (child_count == 0) {
1739 v->next_focusable_view_ = NULL; 1739 v->next_focusable_view_ = NULL;
1740 v->previous_focusable_view_ = NULL; 1740 v->previous_focusable_view_ = NULL;
1741 } else { 1741 } else {
1742 if (index == child_count) { 1742 if (index == child_count) {
1743 // We are inserting at the end, but the end of the child list may not be 1743 // We are inserting at the end, but the end of the child list may not be
1744 // the last focusable element. Let's try to find an element with no next 1744 // the last focusable element. Let's try to find an element with no next
1745 // focusable element to link to. 1745 // focusable element to link to.
1746 View* last_focusable_view = NULL; 1746 View* last_focusable_view = NULL;
1747 for (std::vector<View*>::iterator iter = children_.begin(); 1747 for (ViewVector::iterator iter = children_.begin();
1748 iter != children_.end(); ++iter) { 1748 iter != children_.end(); ++iter) {
1749 if (!(*iter)->next_focusable_view_) { 1749 if (!(*iter)->next_focusable_view_) {
1750 last_focusable_view = *iter; 1750 last_focusable_view = *iter;
1751 break; 1751 break;
1752 } 1752 }
1753 } 1753 }
1754 if (last_focusable_view == NULL) { 1754 if (last_focusable_view == NULL) {
1755 // Hum... there is a cycle in the focus list. Let's just insert ourself 1755 // Hum... there is a cycle in the focus list. Let's just insert ourself
1756 // after the last child. 1756 // after the last child.
1757 View* prev = children_[index - 1]; 1757 View* prev = children_[index - 1];
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 result.append(GetChildViewAt(i)->PrintViewGraph(false)); 1870 result.append(GetChildViewAt(i)->PrintViewGraph(false));
1871 1871
1872 if (first) 1872 if (first)
1873 result.append("}\n"); 1873 result.append("}\n");
1874 1874
1875 return result; 1875 return result;
1876 } 1876 }
1877 #endif 1877 #endif
1878 1878
1879 } // namespace views 1879 } // namespace views
OLDNEW
« no previous file with comments | « views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698