Add ICU message format support
[chromium-blink-merge.git] / ui / views / controls / scrollbar / base_scroll_bar_button.cc
blob54dbe7501ee01024757816a651bf9ceafcaddc79
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.
5 #include "ui/views/controls/scrollbar/base_scroll_bar_button.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "ui/events/event_utils.h"
10 #include "ui/gfx/screen.h"
12 namespace views {
14 BaseScrollBarButton::BaseScrollBarButton(ButtonListener* listener)
15 : CustomButton(listener),
16 repeater_(base::Bind(&BaseScrollBarButton::RepeaterNotifyClick,
17 base::Unretained(this))) {
20 BaseScrollBarButton::~BaseScrollBarButton() {
23 bool BaseScrollBarButton::OnMousePressed(const ui::MouseEvent& event) {
24 Button::NotifyClick(event);
25 repeater_.Start();
26 return true;
29 void BaseScrollBarButton::OnMouseReleased(const ui::MouseEvent& event) {
30 OnMouseCaptureLost();
33 void BaseScrollBarButton::OnMouseCaptureLost() {
34 repeater_.Stop();
37 void BaseScrollBarButton::RepeaterNotifyClick() {
38 // TODO(sky): See if we can convert to using |Screen| everywhere.
39 // TODO(scottmg): Native is wrong: http://crbug.com/133312
40 gfx::Point cursor_point =
41 gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
42 ui::MouseEvent event(ui::ET_MOUSE_RELEASED, cursor_point, cursor_point,
43 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
44 ui::EF_LEFT_MOUSE_BUTTON);
45 Button::NotifyClick(event);
48 } // namespace views