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

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

Issue 2034893003: Fixed interactive ui test regression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc ('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/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/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // handler). 160 // handler).
161 } 161 }
162 return true; 162 return true;
163 } 163 }
164 164
165 bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) { 165 bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) {
166 if (state_ != STATE_DISABLED) { 166 if (state_ != STATE_DISABLED) {
167 if (HitTestPoint(event.location())) { 167 if (HitTestPoint(event.location())) {
168 SetState(ShouldEnterPushedState(event) ? STATE_PRESSED : STATE_HOVERED); 168 SetState(ShouldEnterPushedState(event) ? STATE_PRESSED : STATE_HOVERED);
169 if (!InDrag() && ink_drop_delegate() && 169 if (!InDrag() && ink_drop_delegate() &&
170 ink_drop_delegate()->GetTargetInkDropState() != 170 ink_drop_delegate()->GetTargetInkDropState() ==
171 views::InkDropState::ACTION_PENDING) 171 views::InkDropState::HIDDEN)
172 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); 172 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING);
173 } else { 173 } else {
174 SetState(STATE_NORMAL); 174 SetState(STATE_NORMAL);
175 if (!InDrag() && ink_drop_delegate() && 175 if (!InDrag() && ink_drop_delegate() &&
176 ink_drop_delegate()->GetTargetInkDropState() != 176 ink_drop_delegate()->GetTargetInkDropState() ==
177 views::InkDropState::HIDDEN) 177 views::InkDropState::ACTION_PENDING)
178 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); 178 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN);
179 } 179 }
180 } 180 }
181 return true; 181 return true;
182 } 182 }
183 183
184 void CustomButton::OnMouseReleased(const ui::MouseEvent& event) { 184 void CustomButton::OnMouseReleased(const ui::MouseEvent& event) {
185 if (state_ != STATE_DISABLED) { 185 if (state_ != STATE_DISABLED) {
186 if (!HitTestPoint(event.location())) { 186 if (!HitTestPoint(event.location())) {
187 SetState(STATE_NORMAL); 187 SetState(STATE_NORMAL);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 Button::NotifyClick(event); 468 Button::NotifyClick(event);
469 } 469 }
470 470
471 void CustomButton::OnClickCanceled(const ui::Event& event) { 471 void CustomButton::OnClickCanceled(const ui::Event& event) {
472 if (ink_drop_delegate()) 472 if (ink_drop_delegate())
473 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); 473 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN);
474 Button::OnClickCanceled(event); 474 Button::OnClickCanceled(event);
475 } 475 }
476 476
477 } // namespace views 477 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698