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

Side by Side Diff: ui/views/controls/button/button_dropdown.cc

Issue 14061025: ui: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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/button/button_dropdown.h" 5 #include "ui/views/controls/button/button_dropdown.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 bool ButtonDropDown::OnMousePressed(const ui::MouseEvent& event) { 61 bool ButtonDropDown::OnMousePressed(const ui::MouseEvent& event) {
62 if (enabled() && ShouldShowMenu() && 62 if (enabled() && ShouldShowMenu() &&
63 IsTriggerableEvent(event) && HitTestPoint(event.location())) { 63 IsTriggerableEvent(event) && HitTestPoint(event.location())) {
64 // Store the y pos of the mouse coordinates so we can use them later to 64 // Store the y pos of the mouse coordinates so we can use them later to
65 // determine if the user dragged the mouse down (which should pop up the 65 // determine if the user dragged the mouse down (which should pop up the
66 // drag down menu immediately, instead of waiting for the timer) 66 // drag down menu immediately, instead of waiting for the timer)
67 y_position_on_lbuttondown_ = event.y(); 67 y_position_on_lbuttondown_ = event.y();
68 68
69 // Schedule a task that will show the menu. 69 // Schedule a task that will show the menu.
70 MessageLoop::current()->PostDelayedTask( 70 base::MessageLoop::current()->PostDelayedTask(
71 FROM_HERE, 71 FROM_HERE,
72 base::Bind(&ButtonDropDown::ShowDropDownMenu, 72 base::Bind(&ButtonDropDown::ShowDropDownMenu,
73 show_menu_factory_.GetWeakPtr()), 73 show_menu_factory_.GetWeakPtr()),
74 base::TimeDelta::FromMilliseconds(kMenuTimerDelay)); 74 base::TimeDelta::FromMilliseconds(kMenuTimerDelay));
75 } 75 }
76 return ImageButton::OnMousePressed(event); 76 return ImageButton::OnMousePressed(event);
77 } 77 }
78 78
79 bool ButtonDropDown::OnMouseDragged(const ui::MouseEvent& event) { 79 bool ButtonDropDown::OnMouseDragged(const ui::MouseEvent& event) {
80 bool result = ImageButton::OnMouseDragged(event); 80 bool result = ImageButton::OnMouseDragged(event);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SetState(STATE_NORMAL); 219 SetState(STATE_NORMAL);
220 } 220 }
221 221
222 //////////////////////////////////////////////////////////////////////////////// 222 ////////////////////////////////////////////////////////////////////////////////
223 // 223 //
224 // ButtonDropDown - Accessibility 224 // ButtonDropDown - Accessibility
225 // 225 //
226 //////////////////////////////////////////////////////////////////////////////// 226 ////////////////////////////////////////////////////////////////////////////////
227 227
228 } // namespace views 228 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/bounds_animator_unittest.cc ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698