| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // If this was the last lock, manually reset state to the desired state. | 388 // If this was the last lock, manually reset state to the desired state. |
| 389 if (pressed_lock_count_ == 0) { | 389 if (pressed_lock_count_ == 0) { |
| 390 ButtonState desired_state = STATE_NORMAL; | 390 ButtonState desired_state = STATE_NORMAL; |
| 391 if (should_disable_after_press_) { | 391 if (should_disable_after_press_) { |
| 392 desired_state = STATE_DISABLED; | 392 desired_state = STATE_DISABLED; |
| 393 should_disable_after_press_ = false; | 393 should_disable_after_press_ = false; |
| 394 } else if (ShouldEnterHoveredState()) { | 394 } else if (ShouldEnterHoveredState()) { |
| 395 desired_state = STATE_HOVERED; | 395 desired_state = STATE_HOVERED; |
| 396 } | 396 } |
| 397 SetState(desired_state); | 397 SetState(desired_state); |
| 398 if (state() != STATE_PRESSED) | 398 // The widget may be null during shutdown. If so, it doesn't make sense to |
| 399 // try to add an ink drop effect. |
| 400 if (GetWidget() && state() != STATE_PRESSED) |
| 399 AnimateInkDrop(InkDropState::DEACTIVATED); | 401 AnimateInkDrop(InkDropState::DEACTIVATED); |
| 400 } | 402 } |
| 401 } | 403 } |
| 402 | 404 |
| 403 int MenuButton::GetMaximumScreenXCoordinate() { | 405 int MenuButton::GetMaximumScreenXCoordinate() { |
| 404 if (!GetWidget()) { | 406 if (!GetWidget()) { |
| 405 NOTREACHED(); | 407 NOTREACHED(); |
| 406 return 0; | 408 return 0; |
| 407 } | 409 } |
| 408 | 410 |
| 409 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); | 411 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); |
| 410 return monitor_bounds.right() - 1; | 412 return monitor_bounds.right() - 1; |
| 411 } | 413 } |
| 412 | 414 |
| 413 } // namespace views | 415 } // namespace views |
| OLD | NEW |