diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/scrollbar/base_scroll_bar.cc | 16 | ||||
-rw-r--r-- | views/controls/scrollbar/base_scroll_bar_button.cc | 7 | ||||
-rw-r--r-- | views/controls/scrollbar/bitmap_scroll_bar.cc | 19 | ||||
-rw-r--r-- | views/repeat_controller.cc | 10 | ||||
-rw-r--r-- | views/repeat_controller.h | 11 |
5 files changed, 33 insertions, 30 deletions
diff --git a/views/controls/scrollbar/base_scroll_bar.cc b/views/controls/scrollbar/base_scroll_bar.cc index 59fcf32..9641cbe 100644 --- a/views/controls/scrollbar/base_scroll_bar.cc +++ b/views/controls/scrollbar/base_scroll_bar.cc @@ -4,25 +4,28 @@ #include "views/controls/scrollbar/base_scroll_bar.h" -#if defined(OS_LINUX) -#include "ui/gfx/screen.h" -#endif - +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/string16.h" #include "base/utf_string_conversions.h" +#include "build/build_config.h" #include "grit/ui_strings.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "views/controls/menu/menu_item_view.h" #include "views/controls/menu/menu_runner.h" -#include "views/controls/scrollbar/base_scroll_bar_thumb.h" #include "views/controls/scroll_view.h" +#include "views/controls/scrollbar/base_scroll_bar_thumb.h" #include "views/widget/widget.h" +#if defined(OS_LINUX) +#include "ui/gfx/screen.h" +#endif + #undef min #undef max @@ -39,8 +42,7 @@ BaseScrollBar::BaseScrollBar(bool horizontal, BaseScrollBarThumb* thumb) thumb_track_state_(CustomButton::BS_NORMAL), last_scroll_amount_(SCROLL_NONE), ALLOW_THIS_IN_INITIALIZER_LIST(repeater_( - NewCallback<BaseScrollBar>(this, - &BaseScrollBar::TrackClicked))), + base::Bind(&BaseScrollBar::TrackClicked, base::Unretained(this)))), context_menu_mouse_position_(0) { AddChildView(thumb_); diff --git a/views/controls/scrollbar/base_scroll_bar_button.cc b/views/controls/scrollbar/base_scroll_bar_button.cc index 14f086b..d30358e 100644 --- a/views/controls/scrollbar/base_scroll_bar_button.cc +++ b/views/controls/scrollbar/base_scroll_bar_button.cc @@ -4,13 +4,16 @@ #include "views/controls/scrollbar/base_scroll_bar_button.h" +#include "base/bind.h" +#include "base/bind_helpers.h" + namespace views { BaseScrollBarButton::BaseScrollBarButton(ButtonListener* listener) : CustomButton(listener), ALLOW_THIS_IN_INITIALIZER_LIST(repeater_( - NewCallback<BaseScrollBarButton>(this, - &BaseScrollBarButton::RepeaterNotifyClick))) { + base::Bind(&BaseScrollBarButton::RepeaterNotifyClick, + base::Unretained(this)))) { } BaseScrollBarButton::~BaseScrollBarButton() { diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc index 6350799..7529f99 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -4,25 +4,28 @@ #include "views/controls/scrollbar/bitmap_scroll_bar.h" -#if defined(OS_LINUX) -#include "views/screen.h" -#endif - +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/string16.h" #include "base/utf_string_conversions.h" +#include "build/build_config.h" #include "grit/ui_strings.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "views/controls/menu/menu.h" -#include "views/controls/scrollbar/base_scroll_bar_thumb.h" #include "views/controls/scroll_view.h" +#include "views/controls/scrollbar/base_scroll_bar_thumb.h" #include "views/widget/widget.h" +#if defined(OS_LINUX) +#include "views/screen.h" +#endif + #undef min #undef max @@ -32,7 +35,7 @@ namespace { // The distance the mouse can be dragged outside the bounds of the thumb during // dragging before the scrollbar will snap back to its regular position. -static const int kScrollThumbDragOutSnap = 100; +const int kScrollThumbDragOutSnap = 100; /////////////////////////////////////////////////////////////////////////////// // @@ -48,8 +51,8 @@ class AutorepeatButton : public ImageButton { explicit AutorepeatButton(ButtonListener* listener) : ImageButton(listener), ALLOW_THIS_IN_INITIALIZER_LIST(repeater_( - NewCallback<AutorepeatButton>(this, - &AutorepeatButton::NotifyClick))) { + base::Bind(&AutorepeatButton::NotifyClick, + base::Unretained(this)))) { } virtual ~AutorepeatButton() {} diff --git a/views/repeat_controller.cc b/views/repeat_controller.cc index 37e0892..416b591 100644 --- a/views/repeat_controller.cc +++ b/views/repeat_controller.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,13 +10,13 @@ namespace views { // The delay before the first and then subsequent repeats. Values taken from // XUL code: http://mxr.mozilla.org/seamonkey/source/layout/xul/base/src/nsRepeatService.cpp#52 -static const int kInitialRepeatDelay = 250; -static const int kRepeatDelay = 50; +const int kInitialRepeatDelay = 250; +const int kRepeatDelay = 50; /////////////////////////////////////////////////////////////////////////////// // RepeatController, public: -RepeatController::RepeatController(RepeatCallback* callback) +RepeatController::RepeatController(const base::Closure& callback) : callback_(callback) { } @@ -39,7 +39,7 @@ void RepeatController::Stop() { void RepeatController::Run() { timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kRepeatDelay), this, &RepeatController::Run); - callback_->Run(); + callback_.Run(); } } // namespace views diff --git a/views/repeat_controller.h b/views/repeat_controller.h index 31ab1c7..3384cf0 100644 --- a/views/repeat_controller.h +++ b/views/repeat_controller.h @@ -6,8 +6,7 @@ #define VIEWS_REPEAT_CONTROLLER_H_ #pragma once -#include "base/callback_old.h" -#include "base/memory/scoped_ptr.h" +#include "base/callback.h" #include "base/timer.h" namespace views { @@ -24,10 +23,8 @@ namespace views { /////////////////////////////////////////////////////////////////////////////// class RepeatController { public: - typedef Callback0::Type RepeatCallback; - // The RepeatController takes ownership of this callback object. - explicit RepeatController(RepeatCallback* callback); + explicit RepeatController(const base::Closure& callback); virtual ~RepeatController(); // Start repeating. @@ -37,15 +34,13 @@ class RepeatController { void Stop(); private: - RepeatController(); - // Called when the timer expires. void Run(); // The current timer. base::OneShotTimer<RepeatController> timer_; - scoped_ptr<RepeatCallback> callback_; + base::Closure callback_; DISALLOW_COPY_AND_ASSIGN(RepeatController); }; |