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

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

Issue 1478303003: Converted all Views to use an InkDropDelegate instead of a InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved some ripple controlling logic up the Button hierarchy. Created 5 years 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
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/menu_button.h" 5 #include "ui/views/controls/button/menu_button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/dragdrop/drag_drop_types.h" 9 #include "ui/base/dragdrop/drag_drop_types.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 bool MenuButton::OnMousePressed(const ui::MouseEvent& event) { 178 bool MenuButton::OnMousePressed(const ui::MouseEvent& event) {
179 if (request_focus_on_press()) 179 if (request_focus_on_press())
180 RequestFocus(); 180 RequestFocus();
181 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) && 181 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) &&
182 HitTestPoint(event.location())) { 182 HitTestPoint(event.location())) {
183 TimeDelta delta = TimeTicks::Now() - menu_closed_time_; 183 TimeDelta delta = TimeTicks::Now() - menu_closed_time_;
184 if (delta.InMilliseconds() > kMinimumMsBetweenButtonClicks) 184 if (delta.InMilliseconds() > kMinimumMsBetweenButtonClicks)
185 return Activate(); 185 return Activate();
186 if (ink_drop_delegate())
187 ink_drop_delegate()->OnAction(InkDropState::ACTION_PENDING);
186 } 188 }
187 return true; 189 return true;
188 } 190 }
189 191
190 void MenuButton::OnMouseReleased(const ui::MouseEvent& event) { 192 void MenuButton::OnMouseReleased(const ui::MouseEvent& event) {
191 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) && 193 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) &&
192 HitTestPoint(event.location()) && !InDrag()) { 194 HitTestPoint(event.location()) && !InDrag()) {
193 Activate(); 195 Activate();
194 } else { 196 } else {
195 if (ink_drop_delegate()) 197 if (ink_drop_delegate())
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 if (!GetWidget()) { 362 if (!GetWidget()) {
361 NOTREACHED(); 363 NOTREACHED();
362 return 0; 364 return 0;
363 } 365 }
364 366
365 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 367 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
366 return monitor_bounds.right() - 1; 368 return monitor_bounds.right() - 1;
367 } 369 }
368 370
369 } // namespace views 371 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698