Chromium Code Reviews| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 return NativeScrollBarWrapper::GetHorizontalScrollBarHeight(theme); | 34 return NativeScrollBarWrapper::GetHorizontalScrollBarHeight(theme); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 int NativeScrollBar::GetVerticalScrollBarWidth( | 38 int NativeScrollBar::GetVerticalScrollBarWidth( |
| 39 const ui::NativeTheme* theme) { | 39 const ui::NativeTheme* theme) { |
| 40 return NativeScrollBarWrapper::GetVerticalScrollBarWidth(theme); | 40 return NativeScrollBarWrapper::GetVerticalScrollBarWidth(theme); |
| 41 } | 41 } |
| 42 | 42 |
| 43 //////////////////////////////////////////////////////////////////////////////// | 43 //////////////////////////////////////////////////////////////////////////////// |
| 44 // NativeScrollBar, protected: | |
| 45 NativeScrollBarWrapper* NativeScrollBar::CreateWrapper() { | |
| 46 return NativeScrollBarWrapper::CreateWrapper(this); | |
| 47 } | |
| 48 | |
| 49 //////////////////////////////////////////////////////////////////////////////// | |
| 44 // NativeScrollBar, View overrides: | 50 // NativeScrollBar, View overrides: |
| 45 gfx::Size NativeScrollBar::GetPreferredSize() const { | 51 gfx::Size NativeScrollBar::GetPreferredSize() const { |
| 46 if (native_wrapper_) | 52 if (native_wrapper_) |
| 47 return native_wrapper_->GetView()->GetPreferredSize(); | 53 return native_wrapper_->GetView()->GetPreferredSize(); |
| 48 return gfx::Size(); | 54 return gfx::Size(); |
| 49 } | 55 } |
| 50 | 56 |
| 51 void NativeScrollBar::Layout() { | 57 void NativeScrollBar::Layout() { |
| 52 if (native_wrapper_) { | 58 if (native_wrapper_) { |
| 53 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); | 59 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); |
| 54 native_wrapper_->GetView()->Layout(); | 60 native_wrapper_->GetView()->Layout(); |
| 55 } | 61 } |
| 56 } | 62 } |
| 57 | 63 |
| 58 void NativeScrollBar::ViewHierarchyChanged( | 64 void NativeScrollBar::ViewHierarchyChanged( |
| 59 const ViewHierarchyChangedDetails& details) { | 65 const ViewHierarchyChangedDetails& details) { |
| 60 if (details.is_add && !native_wrapper_ && GetWidget()) { | 66 if (details.is_add && !native_wrapper_ && GetWidget()) { |
| 61 native_wrapper_ = NativeScrollBarWrapper::CreateWrapper(this); | 67 // Create a method to CreateWrapper and then override that shit |
|
tapted
2016/02/08 00:31:15
(lol)
spqchan
2016/02/09 21:21:26
whoops.
| |
| 68 native_wrapper_ = CreateWrapper(); | |
| 69 | |
| 62 AddChildView(native_wrapper_->GetView()); | 70 AddChildView(native_wrapper_->GetView()); |
| 63 } | 71 } |
| 64 } | 72 } |
| 65 | 73 |
| 66 const char* NativeScrollBar::GetClassName() const { | 74 const char* NativeScrollBar::GetClassName() const { |
| 67 return kViewClassName; | 75 return kViewClassName; |
| 68 } | 76 } |
| 69 | 77 |
| 70 // Overridden from View for keyboard UI. | 78 // Overridden from View for keyboard UI. |
| 71 bool NativeScrollBar::OnKeyPressed(const ui::KeyEvent& event) { | 79 bool NativeScrollBar::OnKeyPressed(const ui::KeyEvent& event) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 } | 112 } |
| 105 | 113 |
| 106 int NativeScrollBar::GetPosition() const { | 114 int NativeScrollBar::GetPosition() const { |
| 107 if (!native_wrapper_) | 115 if (!native_wrapper_) |
| 108 return 0; | 116 return 0; |
| 109 return native_wrapper_->GetPosition(); | 117 return native_wrapper_->GetPosition(); |
| 110 } | 118 } |
| 111 | 119 |
| 112 } // namespace views | 120 } // namespace views |
| 113 | 121 |
| OLD | NEW |