| 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 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
| 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/views/animation/scroll_animator.h" | 10 #include "ui/views/animation/scroll_animator.h" |
| 11 #include "ui/views/context_menu_controller.h" | 11 #include "ui/views/context_menu_controller.h" |
| 12 #include "ui/views/controls/button/image_button.h" | 12 #include "ui/views/controls/button/image_button.h" |
| 13 #include "ui/views/controls/menu/menu_delegate.h" | 13 #include "ui/views/controls/menu/menu_delegate.h" |
| 14 #include "ui/views/controls/scrollbar/scroll_bar.h" | 14 #include "ui/views/controls/scrollbar/scroll_bar.h" |
| 15 #include "ui/views/repeat_controller.h" | 15 #include "ui/views/repeat_controller.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 namespace test { |
| 19 class ScrollViewTestApi; |
| 20 } |
| 18 | 21 |
| 19 class BaseScrollBarThumb; | 22 class BaseScrollBarThumb; |
| 20 class MenuRunner; | 23 class MenuRunner; |
| 21 | 24 |
| 22 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
| 23 // | 26 // |
| 24 // BaseScrollBar | 27 // BaseScrollBar |
| 25 // | 28 // |
| 26 /////////////////////////////////////////////////////////////////////////////// | 29 /////////////////////////////////////////////////////////////////////////////// |
| 27 class VIEWS_EXPORT BaseScrollBar : public ScrollBar, | 30 class VIEWS_EXPORT BaseScrollBar : public ScrollBar, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 110 |
| 108 // Wrapper functions that calls the controller. We need this since native | 111 // Wrapper functions that calls the controller. We need this since native |
| 109 // scrollbars wrap around a different scrollbar. When calling the controller | 112 // scrollbars wrap around a different scrollbar. When calling the controller |
| 110 // we need to pass in the appropriate scrollbar. For normal scrollbars it's | 113 // we need to pass in the appropriate scrollbar. For normal scrollbars it's |
| 111 // the |this| scrollbar, for native scrollbars it's the native scrollbar used | 114 // the |this| scrollbar, for native scrollbars it's the native scrollbar used |
| 112 // to create this. | 115 // to create this. |
| 113 virtual void ScrollToPosition(int position); | 116 virtual void ScrollToPosition(int position); |
| 114 virtual int GetScrollIncrement(bool is_page, bool is_positive); | 117 virtual int GetScrollIncrement(bool is_page, bool is_positive); |
| 115 | 118 |
| 116 private: | 119 private: |
| 120 friend class test::ScrollViewTestApi; |
| 121 |
| 117 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ScrollBarFitsToBottom); | 122 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ScrollBarFitsToBottom); |
| 118 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ThumbFullLengthOfTrack); | 123 FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, ThumbFullLengthOfTrack); |
| 119 int GetThumbSizeForTest(); | 124 int GetThumbSizeForTest(); |
| 120 | 125 |
| 121 // Changes to 'pushed' state and starts a timer to scroll repeatedly. | 126 // Changes to 'pushed' state and starts a timer to scroll repeatedly. |
| 122 void ProcessPressEvent(const ui::LocatedEvent& event); | 127 void ProcessPressEvent(const ui::LocatedEvent& event); |
| 123 | 128 |
| 124 // Sets state to |state| and stops the repeater. | 129 // Sets state to |state| and stops the repeater. |
| 125 void SetState(CustomButton::ButtonState state); | 130 void SetState(CustomButton::ButtonState state); |
| 126 | 131 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // TODO(tdresser): This should be removed when raw pixel scrolling for views | 190 // TODO(tdresser): This should be removed when raw pixel scrolling for views |
| 186 // is enabled. See crbug.com/329354. | 191 // is enabled. See crbug.com/329354. |
| 187 gfx::Vector2dF roundoff_error_; | 192 gfx::Vector2dF roundoff_error_; |
| 188 | 193 |
| 189 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); | 194 DISALLOW_COPY_AND_ASSIGN(BaseScrollBar); |
| 190 }; | 195 }; |
| 191 | 196 |
| 192 } // namespace views | 197 } // namespace views |
| 193 | 198 |
| 194 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ | 199 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_H_ |
| OLD | NEW |