OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |