| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.
h" | 5 #include "chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.
h" |
| 6 | 6 |
| 7 #include "ui/aura/client/screen_position_client.h" | 7 #include "ui/aura/client/screen_position_client.h" |
| 8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/events/event_processor.h" | 9 #include "ui/events/event_processor.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return target_rect_.size(); | 81 return target_rect_.size(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void LinkDisambiguationPopup::ZoomBubbleView::OnMouseEvent( | 84 void LinkDisambiguationPopup::ZoomBubbleView::OnMouseEvent( |
| 85 ui::MouseEvent* event) { | 85 ui::MouseEvent* event) { |
| 86 // Transform mouse event back to coordinate system of the web content window | 86 // Transform mouse event back to coordinate system of the web content window |
| 87 // before providing to the callback. | 87 // before providing to the callback. |
| 88 gfx::PointF xform_location( | 88 gfx::PointF xform_location( |
| 89 (event->location().x() / scale_) + target_rect_.x(), | 89 (event->location().x() / scale_) + target_rect_.x(), |
| 90 (event->location().y() / scale_) + target_rect_.y()); | 90 (event->location().y() / scale_) + target_rect_.y()); |
| 91 ui::MouseEvent xform_event(event->type(), xform_location, xform_location, | 91 ui::MouseEvent xform_event( |
| 92 ui::EventTimeForNow(), event->flags(), | 92 event->type(), xform_location, xform_location, ui::EventTimeForNow(), |
| 93 event->changed_button_flags()); | 93 event->flags(), event->changed_button_flags(), |
| 94 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 94 mouse_cb_.Run(&xform_event); | 95 mouse_cb_.Run(&xform_event); |
| 95 event->SetHandled(); | 96 event->SetHandled(); |
| 96 | 97 |
| 97 // If user completed a click we can close the window. | 98 // If user completed a click we can close the window. |
| 98 if (event->type() == ui::EventType::ET_MOUSE_RELEASED) | 99 if (event->type() == ui::EventType::ET_MOUSE_RELEASED) |
| 99 Close(); | 100 Close(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void LinkDisambiguationPopup::ZoomBubbleView::OnGestureEvent( | 103 void LinkDisambiguationPopup::ZoomBubbleView::OnGestureEvent( |
| 103 ui::GestureEvent* event) { | 104 ui::GestureEvent* event) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void LinkDisambiguationPopup::Close() { | 192 void LinkDisambiguationPopup::Close() { |
| 192 if (view_) { | 193 if (view_) { |
| 193 view_->Close(); | 194 view_->Close(); |
| 194 view_ = NULL; | 195 view_ = NULL; |
| 195 } | 196 } |
| 196 } | 197 } |
| 197 | 198 |
| 198 void LinkDisambiguationPopup::InvalidateBubbleView() { | 199 void LinkDisambiguationPopup::InvalidateBubbleView() { |
| 199 view_ = NULL; | 200 view_ = NULL; |
| 200 } | 201 } |
| OLD | NEW |