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/base_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/base_scroll_bar.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "grit/ui_strings.h" | 15 #include "grit/ui_strings.h" |
| 16 #include "ui/base/event.h" |
16 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
19 #include "ui/views/controls/menu/menu_item_view.h" | 20 #include "ui/views/controls/menu/menu_item_view.h" |
20 #include "ui/views/controls/menu/menu_runner.h" | 21 #include "ui/views/controls/menu/menu_runner.h" |
21 #include "ui/views/controls/scroll_view.h" | 22 #include "ui/views/controls/scroll_view.h" |
22 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h" | 23 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h" |
23 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
24 | 25 |
25 #if defined(OS_LINUX) | 26 #if defined(OS_LINUX) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 119 } |
119 | 120 |
120 void BaseScrollBar::OnMouseReleased(const MouseEvent& event) { | 121 void BaseScrollBar::OnMouseReleased(const MouseEvent& event) { |
121 OnMouseCaptureLost(); | 122 OnMouseCaptureLost(); |
122 } | 123 } |
123 | 124 |
124 void BaseScrollBar::OnMouseCaptureLost() { | 125 void BaseScrollBar::OnMouseCaptureLost() { |
125 ResetState(); | 126 ResetState(); |
126 } | 127 } |
127 | 128 |
128 bool BaseScrollBar::OnKeyPressed(const KeyEvent& event) { | 129 bool BaseScrollBar::OnKeyPressed(const ui::KeyEvent& event) { |
129 ScrollAmount amount = SCROLL_NONE; | 130 ScrollAmount amount = SCROLL_NONE; |
130 switch (event.key_code()) { | 131 switch (event.key_code()) { |
131 case ui::VKEY_UP: | 132 case ui::VKEY_UP: |
132 if (!IsHorizontal()) | 133 if (!IsHorizontal()) |
133 amount = SCROLL_PREV_LINE; | 134 amount = SCROLL_PREV_LINE; |
134 break; | 135 break; |
135 case ui::VKEY_DOWN: | 136 case ui::VKEY_DOWN: |
136 if (!IsHorizontal()) | 137 if (!IsHorizontal()) |
137 amount = SCROLL_NEXT_LINE; | 138 amount = SCROLL_NEXT_LINE; |
138 break; | 139 break; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 423 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
423 return (thumb_position * contents_size_) / GetTrackSize(); | 424 return (thumb_position * contents_size_) / GetTrackSize(); |
424 } | 425 } |
425 | 426 |
426 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 427 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
427 thumb_track_state_ = state; | 428 thumb_track_state_ = state; |
428 SchedulePaint(); | 429 SchedulePaint(); |
429 } | 430 } |
430 | 431 |
431 } // namespace views | 432 } // namespace views |
OLD | NEW |