OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/view.h" | 5 #include "chrome/views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #ifndef NDEBUG | 9 #ifndef NDEBUG |
10 #include <iostream> | 10 #include <iostream> |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/scoped_handle.h" | 15 #include "base/scoped_handle.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "chrome/common/drag_drop_types.h" | 17 #include "chrome/common/drag_drop_types.h" |
18 #include "chrome/common/gfx/chrome_canvas.h" | 18 #include "chrome/common/gfx/chrome_canvas.h" |
19 #include "chrome/common/l10n_util.h" | 19 #include "chrome/common/l10n_util.h" |
20 #include "chrome/views/background.h" | 20 #include "chrome/views/background.h" |
21 #include "chrome/views/layout_manager.h" | 21 #include "chrome/views/layout_manager.h" |
22 #include "chrome/views/widget/root_view.h" | 22 #include "chrome/views/widget/root_view.h" |
23 #include "chrome/views/widget/widget.h" | 23 #include "chrome/views/widget/widget.h" |
| 24 #include "chrome/views/window/window.h" |
24 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
25 #include "chrome/views/widget/tooltip_manager.h" | 26 #include "chrome/views/widget/tooltip_manager.h" |
26 #include "chrome/views/accessibility/view_accessibility_wrapper.h" | 27 #include "chrome/views/accessibility/view_accessibility_wrapper.h" |
27 #endif | 28 #endif |
28 #include "SkShader.h" | 29 #include "SkShader.h" |
29 | 30 |
30 namespace views { | 31 namespace views { |
31 | 32 |
32 // static | 33 // static |
33 char View::kViewClassName[] = "chrome/views/View"; | 34 char View::kViewClassName[] = "chrome/views/View"; |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 return GetViewForPoint(point, false); | 740 return GetViewForPoint(point, false); |
740 } | 741 } |
741 return this; | 742 return this; |
742 } | 743 } |
743 | 744 |
744 Widget* View::GetWidget() const { | 745 Widget* View::GetWidget() const { |
745 // The root view holds a reference to this view hierarchy's Widget. | 746 // The root view holds a reference to this view hierarchy's Widget. |
746 return parent_ ? parent_->GetWidget() : NULL; | 747 return parent_ ? parent_->GetWidget() : NULL; |
747 } | 748 } |
748 | 749 |
| 750 Window* View::GetWindow() const { |
| 751 Widget* widget = GetWidget(); |
| 752 return widget ? widget->GetWindow() : NULL; |
| 753 } |
| 754 |
749 // Get the containing RootView | 755 // Get the containing RootView |
750 RootView* View::GetRootView() { | 756 RootView* View::GetRootView() { |
751 Widget* widget = GetWidget(); | 757 Widget* widget = GetWidget(); |
752 return widget ? widget->GetRootView() : NULL; | 758 return widget ? widget->GetRootView() : NULL; |
753 } | 759 } |
754 | 760 |
755 View* View::GetViewByID(int id) const { | 761 View* View::GetViewByID(int id) const { |
756 if (id == id_) | 762 if (id == id_) |
757 return const_cast<View*>(this); | 763 return const_cast<View*>(this); |
758 | 764 |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 start_x = start_y = 0; | 1635 start_x = start_y = 0; |
1630 } | 1636 } |
1631 | 1637 |
1632 void View::DragInfo::PossibleDrag(int x, int y) { | 1638 void View::DragInfo::PossibleDrag(int x, int y) { |
1633 possible_drag = true; | 1639 possible_drag = true; |
1634 start_x = x; | 1640 start_x = x; |
1635 start_y = y; | 1641 start_y = y; |
1636 } | 1642 } |
1637 | 1643 |
1638 } // namespace | 1644 } // namespace |
OLD | NEW |