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

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

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 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
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_node_data.h" 7 #include "ui/accessibility/ax_node_data.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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 if (!event->handled()) 310 if (!event->handled())
311 Button::OnGestureEvent(event); 311 Button::OnGestureEvent(event);
312 } 312 }
313 313
314 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { 314 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) {
315 SetState(STATE_NORMAL); 315 SetState(STATE_NORMAL);
316 // TODO(beng): remove once NotifyClick takes ui::Event. 316 // TODO(beng): remove once NotifyClick takes ui::Event.
317 ui::MouseEvent synthetic_event( 317 ui::MouseEvent synthetic_event(
318 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 318 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
319 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); 319 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
320 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
321 ui::PointerEvent::kMousePointerId));
320 NotifyClick(synthetic_event); 322 NotifyClick(synthetic_event);
321 return true; 323 return true;
322 } 324 }
323 325
324 bool CustomButton::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { 326 bool CustomButton::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
325 // If this button is focused and the user presses space or enter, don't let 327 // If this button is focused and the user presses space or enter, don't let
326 // that be treated as an accelerator if there is a key click action 328 // that be treated as an accelerator if there is a key click action
327 // corresponding to it. 329 // corresponding to it.
328 return GetKeyClickActionForEvent(event) != KeyClickAction::CLICK_NONE; 330 return GetKeyClickActionForEvent(event) != KeyClickAction::CLICK_NONE;
329 } 331 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 views::InkDropState::ACTION_PENDING || 493 views::InkDropState::ACTION_PENDING ||
492 GetInkDrop()->GetTargetInkDropState() == 494 GetInkDrop()->GetTargetInkDropState() ==
493 views::InkDropState::ALTERNATE_ACTION_PENDING) { 495 views::InkDropState::ALTERNATE_ACTION_PENDING) {
494 AnimateInkDrop(views::InkDropState::HIDDEN, 496 AnimateInkDrop(views::InkDropState::HIDDEN,
495 ui::LocatedEvent::FromIfValid(&event)); 497 ui::LocatedEvent::FromIfValid(&event));
496 } 498 }
497 Button::OnClickCanceled(event); 499 Button::OnClickCanceled(event);
498 } 500 }
499 501
500 } // namespace views 502 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698