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

Side by Side Diff: ui/views/controls/menu/menu_controller.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/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 } 2502 }
2503 View* active_mouse_view = GetActiveMouseView(); 2503 View* active_mouse_view = GetActiveMouseView();
2504 if (target != active_mouse_view) { 2504 if (target != active_mouse_view) {
2505 SendMouseCaptureLostToActiveView(); 2505 SendMouseCaptureLostToActiveView();
2506 active_mouse_view = target; 2506 active_mouse_view = target;
2507 SetActiveMouseView(active_mouse_view); 2507 SetActiveMouseView(active_mouse_view);
2508 if (active_mouse_view) { 2508 if (active_mouse_view) {
2509 gfx::Point target_point(target_menu_loc); 2509 gfx::Point target_point(target_menu_loc);
2510 View::ConvertPointToTarget( 2510 View::ConvertPointToTarget(
2511 target_menu, active_mouse_view, &target_point); 2511 target_menu, active_mouse_view, &target_point);
2512 ui::MouseEvent mouse_entered_event(ui::ET_MOUSE_ENTERED, target_point, 2512 ui::MouseEvent mouse_entered_event(
2513 target_point, ui::EventTimeForNow(), 0, 2513 ui::ET_MOUSE_ENTERED, target_point, target_point,
2514 0); 2514 ui::EventTimeForNow(), 0, 0,
2515 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
2516 ui::PointerEvent::kMousePointerId));
2515 active_mouse_view->OnMouseEntered(mouse_entered_event); 2517 active_mouse_view->OnMouseEntered(mouse_entered_event);
2516 2518
2517 ui::MouseEvent mouse_pressed_event( 2519 ui::MouseEvent mouse_pressed_event(
2518 ui::ET_MOUSE_PRESSED, target_point, target_point, 2520 ui::ET_MOUSE_PRESSED, target_point, target_point,
2519 ui::EventTimeForNow(), event.flags(), event.changed_button_flags()); 2521 ui::EventTimeForNow(), event.flags(), event.changed_button_flags(),
2522 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
2523 ui::PointerEvent::kMousePointerId));
2520 active_mouse_view->OnMousePressed(mouse_pressed_event); 2524 active_mouse_view->OnMousePressed(mouse_pressed_event);
2521 } 2525 }
2522 } 2526 }
2523 2527
2524 if (active_mouse_view) { 2528 if (active_mouse_view) {
2525 gfx::Point target_point(target_menu_loc); 2529 gfx::Point target_point(target_menu_loc);
2526 View::ConvertPointToTarget(target_menu, active_mouse_view, &target_point); 2530 View::ConvertPointToTarget(target_menu, active_mouse_view, &target_point);
2527 ui::MouseEvent mouse_dragged_event( 2531 ui::MouseEvent mouse_dragged_event(
2528 ui::ET_MOUSE_DRAGGED, target_point, target_point, ui::EventTimeForNow(), 2532 ui::ET_MOUSE_DRAGGED, target_point, target_point, ui::EventTimeForNow(),
2529 event.flags(), event.changed_button_flags()); 2533 event.flags(), event.changed_button_flags(),
2534 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
2535 ui::PointerEvent::kMousePointerId));
2530 active_mouse_view->OnMouseDragged(mouse_dragged_event); 2536 active_mouse_view->OnMouseDragged(mouse_dragged_event);
2531 } 2537 }
2532 } 2538 }
2533 2539
2534 void MenuController::SendMouseReleaseToActiveView(SubmenuView* event_source, 2540 void MenuController::SendMouseReleaseToActiveView(SubmenuView* event_source,
2535 const ui::MouseEvent& event) { 2541 const ui::MouseEvent& event) {
2536 View* active_mouse_view = GetActiveMouseView(); 2542 View* active_mouse_view = GetActiveMouseView();
2537 if (!active_mouse_view) 2543 if (!active_mouse_view)
2538 return; 2544 return;
2539 2545
2540 gfx::Point target_loc(event.location()); 2546 gfx::Point target_loc(event.location());
2541 View::ConvertPointToScreen(event_source->GetScrollViewContainer(), 2547 View::ConvertPointToScreen(event_source->GetScrollViewContainer(),
2542 &target_loc); 2548 &target_loc);
2543 View::ConvertPointFromScreen(active_mouse_view, &target_loc); 2549 View::ConvertPointFromScreen(active_mouse_view, &target_loc);
2544 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, target_loc, target_loc, 2550 ui::MouseEvent release_event(
2545 ui::EventTimeForNow(), event.flags(), 2551 ui::ET_MOUSE_RELEASED, target_loc, target_loc, ui::EventTimeForNow(),
2546 event.changed_button_flags()); 2552 event.flags(), event.changed_button_flags(),
2553 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
2554 ui::PointerEvent::kMousePointerId));
2547 // Reset active mouse view before sending mouse released. That way if it calls 2555 // Reset active mouse view before sending mouse released. That way if it calls
2548 // back to us, we aren't in a weird state. 2556 // back to us, we aren't in a weird state.
2549 SetActiveMouseView(NULL); 2557 SetActiveMouseView(NULL);
2550 active_mouse_view->OnMouseReleased(release_event); 2558 active_mouse_view->OnMouseReleased(release_event);
2551 } 2559 }
2552 2560
2553 void MenuController::SendMouseCaptureLostToActiveView() { 2561 void MenuController::SendMouseCaptureLostToActiveView() {
2554 View* active_mouse_view = GetActiveMouseView(); 2562 View* active_mouse_view = GetActiveMouseView();
2555 if (!active_mouse_view) 2563 if (!active_mouse_view)
2556 return; 2564 return;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 if (hot_button_) 2765 if (hot_button_)
2758 hot_button_->SetHotTracked(false); 2766 hot_button_->SetHotTracked(false);
2759 hot_button_ = hot_button; 2767 hot_button_ = hot_button;
2760 if (hot_button) { 2768 if (hot_button) {
2761 hot_button->SetHotTracked(true); 2769 hot_button->SetHotTracked(true);
2762 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); 2770 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true);
2763 } 2771 }
2764 } 2772 }
2765 2773
2766 } // namespace views 2774 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698