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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 bool MenuButton::OnMousePressed(const ui::MouseEvent& event) { | 177 bool MenuButton::OnMousePressed(const ui::MouseEvent& event) { |
178 if (request_focus_on_press()) | 178 if (request_focus_on_press()) |
179 RequestFocus(); | 179 RequestFocus(); |
180 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) && | 180 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) && |
181 HitTestPoint(event.location())) { | 181 HitTestPoint(event.location())) { |
182 TimeDelta delta = TimeTicks::Now() - menu_closed_time_; | 182 TimeDelta delta = TimeTicks::Now() - menu_closed_time_; |
183 if (delta.InMilliseconds() > kMinimumMsBetweenButtonClicks) | 183 if (delta.InMilliseconds() > kMinimumMsBetweenButtonClicks) |
184 return Activate(); | 184 return Activate(); |
| 185 if (ink_drop_delegate()) |
| 186 ink_drop_delegate()->OnAction(InkDropState::ACTION_PENDING); |
185 } | 187 } |
186 return true; | 188 return true; |
187 } | 189 } |
188 | 190 |
189 void MenuButton::OnMouseReleased(const ui::MouseEvent& event) { | 191 void MenuButton::OnMouseReleased(const ui::MouseEvent& event) { |
190 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) && | 192 if (state() != STATE_DISABLED && ShouldEnterPushedState(event) && |
191 HitTestPoint(event.location()) && !InDrag()) { | 193 HitTestPoint(event.location()) && !InDrag()) { |
192 Activate(); | 194 Activate(); |
193 } else { | 195 } else { |
194 if (ink_drop_delegate()) | 196 if (ink_drop_delegate()) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (!GetWidget()) { | 364 if (!GetWidget()) { |
363 NOTREACHED(); | 365 NOTREACHED(); |
364 return 0; | 366 return 0; |
365 } | 367 } |
366 | 368 |
367 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); | 369 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); |
368 return monitor_bounds.right() - 1; | 370 return monitor_bounds.right() - 1; |
369 } | 371 } |
370 | 372 |
371 } // namespace views | 373 } // namespace views |
OLD | NEW |