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

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

Issue 404213003: [WIP] Allow scroll events to permanently change the default gesture handler in RootView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: friend test Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/overlay_scroll_bar.h" 5 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
6 6
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "third_party/skia/include/core/SkXfermode.h" 8 #include "third_party/skia/include/core/SkXfermode.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 animation_.Hide(); 122 animation_.Hide();
123 } 123 }
124 124
125 void OverlayScrollBar::OnGestureEvent(ui::GestureEvent* event) { 125 void OverlayScrollBar::OnGestureEvent(ui::GestureEvent* event) {
126 switch (event->type()) { 126 switch (event->type()) {
127 case ui::ET_GESTURE_SCROLL_BEGIN: 127 case ui::ET_GESTURE_SCROLL_BEGIN:
128 animation_.Show(); 128 animation_.Show();
129 break; 129 break;
130 case ui::ET_GESTURE_SCROLL_END: 130 case ui::ET_GESTURE_SCROLL_END:
131 case ui::ET_SCROLL_FLING_START: 131 case ui::ET_SCROLL_FLING_START:
132 case ui::ET_GESTURE_END:
133 animation_.Hide(); 132 animation_.Hide();
134 break; 133 break;
135 default: 134 default:
136 break; 135 break;
137 } 136 }
138 BaseScrollBar::OnGestureEvent(event); 137 BaseScrollBar::OnGestureEvent(event);
139 } 138 }
140 139
141 gfx::Size OverlayScrollBar::GetPreferredSize() const { 140 gfx::Size OverlayScrollBar::GetPreferredSize() const {
142 return gfx::Size(); 141 return gfx::Size();
143 } 142 }
144 143
145 void OverlayScrollBar::Layout() { 144 void OverlayScrollBar::Layout() {
146 gfx::Rect thumb_bounds = GetTrackBounds(); 145 gfx::Rect thumb_bounds = GetTrackBounds();
147 BaseScrollBarThumb* thumb = GetThumb(); 146 BaseScrollBarThumb* thumb = GetThumb();
148 if (IsHorizontal()) { 147 if (IsHorizontal()) {
149 thumb_bounds.set_x(thumb->x()); 148 thumb_bounds.set_x(thumb->x());
150 thumb_bounds.set_width(thumb->width()); 149 thumb_bounds.set_width(thumb->width());
151 } else { 150 } else {
152 thumb_bounds.set_y(thumb->y()); 151 thumb_bounds.set_y(thumb->y());
153 thumb_bounds.set_height(thumb->height()); 152 thumb_bounds.set_height(thumb->height());
154 } 153 }
155 thumb->SetBoundsRect(thumb_bounds); 154 thumb->SetBoundsRect(thumb_bounds);
156 } 155 }
157 156
158 void OverlayScrollBar::OnPaint(gfx::Canvas* canvas) { 157 void OverlayScrollBar::OnPaint(gfx::Canvas* canvas) {
159 } 158 }
160 159
161 } // namespace views 160 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698