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

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

Issue 2680643002: Add old_state parameter to CustomButton::StateChanged (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « ui/views/controls/button/menu_button.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/base/dragdrop/drag_drop_types.h" 9 #include "ui/base/dragdrop/drag_drop_types.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (delta.InMilliseconds() < kMinimumMsBetweenButtonClicks) 338 if (delta.InMilliseconds() < kMinimumMsBetweenButtonClicks)
339 return false; // Not enough time since the menu closed. 339 return false; // Not enough time since the menu closed.
340 340
341 return true; 341 return true;
342 } 342 }
343 343
344 bool MenuButton::ShouldEnterPushedState(const ui::Event& event) { 344 bool MenuButton::ShouldEnterPushedState(const ui::Event& event) {
345 return IsTriggerableEventType(event); 345 return IsTriggerableEventType(event);
346 } 346 }
347 347
348 void MenuButton::StateChanged() { 348 void MenuButton::StateChanged(ButtonState old_state) {
349 if (pressed_lock_count_ != 0) { 349 if (pressed_lock_count_ != 0) {
350 // The button's state was changed while it was supposed to be locked in a 350 // The button's state was changed while it was supposed to be locked in a
351 // pressed state. This shouldn't happen, but conceivably could if a caller 351 // pressed state. This shouldn't happen, but conceivably could if a caller
352 // tries to switch from enabled to disabled or vice versa while the button 352 // tries to switch from enabled to disabled or vice versa while the button
353 // is pressed. 353 // is pressed.
354 if (state() == STATE_NORMAL) 354 if (state() == STATE_NORMAL)
355 should_disable_after_press_ = false; 355 should_disable_after_press_ = false;
356 else if (state() == STATE_DISABLED) 356 else if (state() == STATE_DISABLED)
357 should_disable_after_press_ = true; 357 should_disable_after_press_ = true;
358 } else { 358 } else {
359 LabelButton::StateChanged(); 359 LabelButton::StateChanged(old_state);
360 } 360 }
361 } 361 }
362 362
363 void MenuButton::NotifyClick(const ui::Event& event) { 363 void MenuButton::NotifyClick(const ui::Event& event) {
364 // We don't forward events to the normal button listener, instead using the 364 // We don't forward events to the normal button listener, instead using the
365 // MenuButtonListener. 365 // MenuButtonListener.
366 Activate(&event); 366 Activate(&event);
367 } 367 }
368 368
369 void MenuButton::IncrementPressedLocked(bool snap_ink_drop_to_activated) { 369 void MenuButton::IncrementPressedLocked(bool snap_ink_drop_to_activated) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (!GetWidget()) { 406 if (!GetWidget()) {
407 NOTREACHED(); 407 NOTREACHED();
408 return 0; 408 return 0;
409 } 409 }
410 410
411 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 411 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
412 return monitor_bounds.right() - 1; 412 return monitor_bounds.right() - 1;
413 } 413 }
414 414
415 } // namespace views 415 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/menu_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698