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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/controls/scrollbar/base_scroll_bar_button.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "ui/gfx/screen.h"
10
11 namespace views {
12
13 BaseScrollBarButton::BaseScrollBarButton(ButtonListener* listener)
14 : CustomButton(listener),
15 repeater_(base::Bind(&BaseScrollBarButton::RepeaterNotifyClick,
16 base::Unretained(this))) {
17 }
18
19 BaseScrollBarButton::~BaseScrollBarButton() {
20 }
21
22 bool BaseScrollBarButton::OnMousePressed(const ui::MouseEvent& event) {
23 Button::NotifyClick(event);
24 repeater_.Start();
25 return true;
26 }
27
28 void BaseScrollBarButton::OnMouseReleased(const ui::MouseEvent& event) {
29 OnMouseCaptureLost();
30 }
31
32 void BaseScrollBarButton::OnMouseCaptureLost() {
33 repeater_.Stop();
34 }
35
36 void BaseScrollBarButton::RepeaterNotifyClick() {
37 // TODO(sky): See if we can convert to using |Screen| everywhere.
38 // TODO(scottmg): Native is wrong: http://crbug.com/133312
39 gfx::Point cursor_point =
40 gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
41 ui::MouseEvent event(ui::ET_MOUSE_RELEASED,
42 cursor_point, cursor_point,
43 ui::EF_LEFT_MOUSE_BUTTON,
44 ui::EF_LEFT_MOUSE_BUTTON);
45 Button::NotifyClick(event);
46 }
47
48 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar_button.h ('k') | ui/views/controls/scrollbar/base_scroll_bar_thumb.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698