Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: ui/views/controls/scrollbar/native_scroll_bar.cc

Issue 1671313002: MacViews: Overlay Scrollbars with Show/Hide Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 native_wrapper_ = CreateWrapper();
68
62 AddChildView(native_wrapper_->GetView()); 69 AddChildView(native_wrapper_->GetView());
63 } 70 }
64 } 71 }
65 72
66 const char* NativeScrollBar::GetClassName() const { 73 const char* NativeScrollBar::GetClassName() const {
67 return kViewClassName; 74 return kViewClassName;
68 } 75 }
69 76
70 // Overridden from View for keyboard UI. 77 // Overridden from View for keyboard UI.
71 bool NativeScrollBar::OnKeyPressed(const ui::KeyEvent& event) { 78 bool NativeScrollBar::OnKeyPressed(const ui::KeyEvent& event) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 111 }
105 112
106 int NativeScrollBar::GetPosition() const { 113 int NativeScrollBar::GetPosition() const {
107 if (!native_wrapper_) 114 if (!native_wrapper_)
108 return 0; 115 return 0;
109 return native_wrapper_->GetPosition(); 116 return native_wrapper_->GetPosition();
110 } 117 }
111 118
112 } // namespace views 119 } // namespace views
113 120
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698