OLD | NEW |
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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 if (group_ == group_id) | 547 if (group_ == group_id) |
548 out->push_back(this); | 548 out->push_back(this); |
549 | 549 |
550 for (int i = 0, count = child_count(); i < count; ++i) | 550 for (int i = 0, count = child_count(); i < count; ++i) |
551 GetChildViewAt(i)->GetViewsWithGroup(group_id, out); | 551 GetChildViewAt(i)->GetViewsWithGroup(group_id, out); |
552 } | 552 } |
553 | 553 |
554 View* View::GetSelectedViewForGroup(int group_id) { | 554 View* View::GetSelectedViewForGroup(int group_id) { |
555 std::vector<View*> views; | 555 std::vector<View*> views; |
556 GetWidget()->GetRootView()->GetViewsWithGroup(group_id, &views); | 556 GetWidget()->GetRootView()->GetViewsWithGroup(group_id, &views); |
557 if (views.size() > 0) | 557 return views.empty() ? NULL : views[0]; |
558 return views[0]; | |
559 else | |
560 return NULL; | |
561 } | 558 } |
562 | 559 |
563 // Coordinate conversion ------------------------------------------------------- | 560 // Coordinate conversion ------------------------------------------------------- |
564 | 561 |
565 // static | 562 // static |
566 void View::ConvertPointToView(const View* src, | 563 void View::ConvertPointToView(const View* src, |
567 const View* dst, | 564 const View* dst, |
568 gfx::Point* point) { | 565 gfx::Point* point) { |
569 ConvertPointToView(src, dst, point, true); | 566 ConvertPointToView(src, dst, point, true); |
570 } | 567 } |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 | 1616 |
1620 OSExchangeData data; | 1617 OSExchangeData data; |
1621 WriteDragData(press_pt, &data); | 1618 WriteDragData(press_pt, &data); |
1622 | 1619 |
1623 // Message the RootView to do the drag and drop. That way if we're removed | 1620 // Message the RootView to do the drag and drop. That way if we're removed |
1624 // the RootView can detect it and avoid calling us back. | 1621 // the RootView can detect it and avoid calling us back. |
1625 GetWidget()->StartDragForViewFromMouseEvent(this, data, drag_operations); | 1622 GetWidget()->StartDragForViewFromMouseEvent(this, data, drag_operations); |
1626 } | 1623 } |
1627 | 1624 |
1628 } // namespace views | 1625 } // namespace views |
OLD | NEW |