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

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

Issue 1517003002: Fixes stale hover or ink ripple visuals when dragging over extension buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes stale hover or ink ripple visuals when dragging over extension buttons (nits) Created 4 years, 11 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 | « no previous file | ui/views/controls/button/custom_button_unittest.cc » ('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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 } 180 }
181 if (notify_action_ == NOTIFY_ON_RELEASE) 181 if (notify_action_ == NOTIFY_ON_RELEASE)
182 OnClickCanceled(event); 182 OnClickCanceled(event);
183 } 183 }
184 184
185 void CustomButton::OnMouseCaptureLost() { 185 void CustomButton::OnMouseCaptureLost() {
186 // Starting a drag results in a MouseCaptureLost, we need to ignore it. 186 // Starting a drag results in a MouseCaptureLost, we need to ignore it.
187 if (state_ != STATE_DISABLED && !InDrag()) 187 if (state_ != STATE_DISABLED && !InDrag())
188 SetState(STATE_NORMAL); 188 SetState(STATE_NORMAL);
189 if (ink_drop_delegate_)
190 ink_drop_delegate_->OnAction(views::InkDropState::HIDDEN);
189 } 191 }
190 192
191 void CustomButton::OnMouseEntered(const ui::MouseEvent& event) { 193 void CustomButton::OnMouseEntered(const ui::MouseEvent& event) {
192 if (state_ != STATE_DISABLED) 194 if (state_ != STATE_DISABLED)
193 SetState(STATE_HOVERED); 195 SetState(STATE_HOVERED);
194 } 196 }
195 197
196 void CustomButton::OnMouseExited(const ui::MouseEvent& event) { 198 void CustomButton::OnMouseExited(const ui::MouseEvent& event) {
197 // Starting a drag results in a MouseExited, we need to ignore it. 199 // Starting a drag results in a MouseExited, we need to ignore it.
198 if (state_ != STATE_DISABLED && !InDrag()) 200 if (state_ != STATE_DISABLED && !InDrag())
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); 424 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
423 } 425 }
424 426
425 bool CustomButton::FocusInChildWidget() const { 427 bool CustomButton::FocusInChildWidget() const {
426 return GetWidget() && 428 return GetWidget() &&
427 GetWidget()->GetRootView()->Contains( 429 GetWidget()->GetRootView()->Contains(
428 GetFocusManager()->GetFocusedView()); 430 GetFocusManager()->GetFocusedView());
429 } 431 }
430 432
431 } // namespace views 433 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698