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/controls/scrollbar/native_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/native_scroll_bar.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "ui/base/event.h" |
11 #include "ui/views/controls/scrollbar/native_scroll_bar_wrapper.h" | 12 #include "ui/views/controls/scrollbar/native_scroll_bar_wrapper.h" |
12 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
13 | 14 |
14 #if defined(USE_AURA) | 15 #if defined(USE_AURA) |
15 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h" | 16 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h" |
16 #endif | 17 #endif |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 | 20 |
20 // static | 21 // static |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 native_wrapper_ = NativeScrollBarWrapper::CreateWrapper(this); | 63 native_wrapper_ = NativeScrollBarWrapper::CreateWrapper(this); |
63 AddChildView(native_wrapper_->GetView()); | 64 AddChildView(native_wrapper_->GetView()); |
64 } | 65 } |
65 } | 66 } |
66 | 67 |
67 std::string NativeScrollBar::GetClassName() const { | 68 std::string NativeScrollBar::GetClassName() const { |
68 return kViewClassName; | 69 return kViewClassName; |
69 } | 70 } |
70 | 71 |
71 // Overridden from View for keyboard UI. | 72 // Overridden from View for keyboard UI. |
72 bool NativeScrollBar::OnKeyPressed(const KeyEvent& event) { | 73 bool NativeScrollBar::OnKeyPressed(const ui::KeyEvent& event) { |
73 if (!native_wrapper_) | 74 if (!native_wrapper_) |
74 return false; | 75 return false; |
75 return native_wrapper_->GetView()->OnKeyPressed(event); | 76 return native_wrapper_->GetView()->OnKeyPressed(event); |
76 } | 77 } |
77 | 78 |
78 ui::GestureStatus NativeScrollBar::OnGestureEvent(const GestureEvent& event) { | 79 ui::GestureStatus NativeScrollBar::OnGestureEvent(const GestureEvent& event) { |
79 if (!native_wrapper_) | 80 if (!native_wrapper_) |
80 return ui::GESTURE_STATUS_UNKNOWN; | 81 return ui::GESTURE_STATUS_UNKNOWN; |
81 return native_wrapper_->GetView()->OnGestureEvent(event); | 82 return native_wrapper_->GetView()->OnGestureEvent(event); |
82 } | 83 } |
(...skipping 21 matching lines...) Expand all Loading... |
104 } | 105 } |
105 | 106 |
106 int NativeScrollBar::GetPosition() const { | 107 int NativeScrollBar::GetPosition() const { |
107 if (!native_wrapper_) | 108 if (!native_wrapper_) |
108 return 0; | 109 return 0; |
109 return native_wrapper_->GetPosition(); | 110 return native_wrapper_->GetPosition(); |
110 } | 111 } |
111 | 112 |
112 } // namespace views | 113 } // namespace views |
113 | 114 |
OLD | NEW |