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

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

Issue 1518463002: Hides ink ripple when a button drag is started (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hides ink ripple when a button drag is started (-logs) Created 5 years 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/custom_button.h ('k') | ui/views/view.h » ('j') | 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/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 if (!context_menu_controller()) 280 if (!context_menu_controller())
281 return; 281 return;
282 282
283 // We're about to show the context menu. Showing the context menu likely means 283 // We're about to show the context menu. Showing the context menu likely means
284 // we won't get a mouse exited and reset state. Reset it now to be sure. 284 // we won't get a mouse exited and reset state. Reset it now to be sure.
285 if (state_ != STATE_DISABLED) 285 if (state_ != STATE_DISABLED)
286 SetState(STATE_NORMAL); 286 SetState(STATE_NORMAL);
287 View::ShowContextMenu(p, source_type); 287 View::ShowContextMenu(p, source_type);
288 } 288 }
289 289
290 void CustomButton::OnDragStarted(const ui::LocatedEvent& event) {
291 Button::OnDragStarted(event);
292 if (ink_drop_delegate_)
293 ink_drop_delegate_->OnAction(InkDropState::HIDDEN);
294 }
295
290 void CustomButton::OnDragDone() { 296 void CustomButton::OnDragDone() {
291 // Only reset the state to normal if the button isn't currently disabled 297 // Only reset the state to normal if the button isn't currently disabled
292 // (since disabled buttons may still be able to be dragged). 298 // (since disabled buttons may still be able to be dragged).
293 if (state_ != STATE_DISABLED) 299 if (state_ != STATE_DISABLED)
294 SetState(STATE_NORMAL); 300 SetState(STATE_NORMAL);
295 if (ink_drop_delegate_) 301 if (ink_drop_delegate_)
296 ink_drop_delegate_->OnAction(InkDropState::HIDDEN); 302 ink_drop_delegate_->OnAction(InkDropState::HIDDEN);
297 } 303 }
298 304
299 void CustomButton::GetAccessibleState(ui::AXViewState* state) { 305 void CustomButton::GetAccessibleState(ui::AXViewState* state) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); 416 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
411 } 417 }
412 418
413 bool CustomButton::FocusInChildWidget() const { 419 bool CustomButton::FocusInChildWidget() const {
414 return GetWidget() && 420 return GetWidget() &&
415 GetWidget()->GetRootView()->Contains( 421 GetWidget()->GetRootView()->Contains(
416 GetFocusManager()->GetFocusedView()); 422 GetFocusManager()->GetFocusedView());
417 } 423 }
418 424
419 } // namespace views 425 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698