Chromium Code Reviews| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 // If this was the last lock, manually reset state to the desired state. | 393 // If this was the last lock, manually reset state to the desired state. |
| 394 if (pressed_lock_count_ == 0) { | 394 if (pressed_lock_count_ == 0) { |
| 395 ButtonState desired_state = STATE_NORMAL; | 395 ButtonState desired_state = STATE_NORMAL; |
| 396 if (should_disable_after_press_) { | 396 if (should_disable_after_press_) { |
| 397 desired_state = STATE_DISABLED; | 397 desired_state = STATE_DISABLED; |
| 398 should_disable_after_press_ = false; | 398 should_disable_after_press_ = false; |
| 399 } else if (ShouldEnterHoveredState()) { | 399 } else if (ShouldEnterHoveredState()) { |
| 400 desired_state = STATE_HOVERED; | 400 desired_state = STATE_HOVERED; |
| 401 } | 401 } |
| 402 SetState(desired_state); | 402 SetState(desired_state); |
| 403 if (ink_drop_delegate() && state() != STATE_PRESSED) | 403 // The widget may be null during shutdown. |
|
bruthig
2016/06/03 22:35:25
nit: Can you beef up this comment a little. It is
Evan Stade
2016/06/03 22:42:40
Done. Creating an ink drop requires a native theme
| |
| 404 if (GetWidget() && ink_drop_delegate() && state() != STATE_PRESSED) | |
| 404 ink_drop_delegate()->OnAction(InkDropState::DEACTIVATED); | 405 ink_drop_delegate()->OnAction(InkDropState::DEACTIVATED); |
| 405 } | 406 } |
| 406 } | 407 } |
| 407 | 408 |
| 408 int MenuButton::GetMaximumScreenXCoordinate() { | 409 int MenuButton::GetMaximumScreenXCoordinate() { |
| 409 if (!GetWidget()) { | 410 if (!GetWidget()) { |
| 410 NOTREACHED(); | 411 NOTREACHED(); |
| 411 return 0; | 412 return 0; |
| 412 } | 413 } |
| 413 | 414 |
| 414 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); | 415 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); |
| 415 return monitor_bounds.right() - 1; | 416 return monitor_bounds.right() - 1; |
| 416 } | 417 } |
| 417 | 418 |
| 418 } // namespace views | 419 } // namespace views |
| OLD | NEW |