From aadcd1d93fc5f41fad7ccd22b97215bdd6bb7d5d Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Tue, 22 Sep 2009 18:11:31 +0000 Subject: Implements a NOTIMPLEMENTED in GoButton. BUG=none TEST=none Review URL: http://codereview.chromium.org/216045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26832 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/go_button.cc | 13 +------------ chrome/browser/views/go_button.h | 1 - views/view.h | 3 +++ views/view_gtk.cc | 6 ++++++ views/view_win.cc | 5 +++++ 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/chrome/browser/views/go_button.cc b/chrome/browser/views/go_button.cc index ca9c155..4f55244 100644 --- a/chrome/browser/views/go_button.cc +++ b/chrome/browser/views/go_button.cc @@ -20,7 +20,6 @@ GoButton::GoButton(LocationBarView* location_bar, Browser* browser) : ToggleImageButton(this), - button_delay_(0), ALLOW_THIS_IN_INITIALIZER_LIST(stop_timer_(this)), location_bar_(location_bar), browser_(browser), @@ -63,16 +62,6 @@ void GoButton::ButtonPressed(views::Button* button, const views::Event& event) { // If the go button is visible and not within the double click timer, go. browser_->Go(event_utils::DispositionFromEventFlags(mouse_event_flags())); - // Figure out the system double-click time. - if (button_delay_ == 0) { -#if defined(OS_WIN) - button_delay_ = GetDoubleClickTime(); -#else - NOTIMPLEMENTED(); - button_delay_ = 500; -#endif - } - // Stop any existing timers. stop_timer_.RevokeAll(); @@ -83,7 +72,7 @@ void GoButton::ButtonPressed(views::Button* button, const views::Event& event) { // some delay). MessageLoop::current()->PostDelayedTask(FROM_HERE, stop_timer_.NewRunnableMethod(&GoButton::OnButtonTimer), - button_delay_); + GetDoubleClickTimeMS()); } } diff --git a/chrome/browser/views/go_button.h b/chrome/browser/views/go_button.h index f53117c..735ca54 100644 --- a/chrome/browser/views/go_button.h +++ b/chrome/browser/views/go_button.h @@ -46,7 +46,6 @@ class GoButton : public views::ToggleImageButton, private: void OnButtonTimer(); - int button_delay_; ScopedRunnableMethodFactory stop_timer_; LocationBarView* location_bar_; diff --git a/views/view.h b/views/view.h index 05b32ae..311e5ce 100644 --- a/views/view.h +++ b/views/view.h @@ -126,6 +126,9 @@ class View : public AcceleratorTarget { View(); virtual ~View(); + // Returns the amount of time between double clicks, in milliseconds. + static int GetDoubleClickTimeMS(); + // Sizing functions // Get the bounds of the View, relative to the parent. Essentially, this diff --git a/views/view_gtk.cc b/views/view_gtk.cc index 655f88f..0e53b38 100644 --- a/views/view_gtk.cc +++ b/views/view_gtk.cc @@ -10,6 +10,12 @@ namespace views { +// static +int View::GetDoubleClickTimeMS() { + GdkDisplay* display = gdk_display_get_default(); + return display ? display->double_click_time : 500; +} + ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { NOTIMPLEMENTED(); return NULL; diff --git a/views/view_win.cc b/views/view_win.cc index cd9911c..e5f1c4f 100644 --- a/views/view_win.cc +++ b/views/view_win.cc @@ -15,6 +15,11 @@ namespace views { +// static +int View::GetDoubleClickTimeMS() { + return ::GetDoubleClickTime(); +} + ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { if (accessibility_.get() == NULL) { accessibility_.reset(new ViewAccessibilityWrapper(this)); -- cgit v1.1