| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 gfx::Size LinkDisambiguationPopup::ZoomBubbleView::GetPreferredSize() const { | 80 gfx::Size LinkDisambiguationPopup::ZoomBubbleView::GetPreferredSize() const { |
| 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 ui::MouseEvent xform_event(event->type(), gfx::Point(), gfx::Point(), |
| 89 ui::EventTimeForNow(), event->flags(), |
| 90 event->changed_button_flags()); |
| 88 gfx::PointF xform_location( | 91 gfx::PointF xform_location( |
| 89 (event->location().x() / scale_) + target_rect_.x(), | 92 (event->location().x() / scale_) + target_rect_.x(), |
| 90 (event->location().y() / scale_) + target_rect_.y()); | 93 (event->location().y() / scale_) + target_rect_.y()); |
| 91 ui::MouseEvent xform_event(event->type(), xform_location, xform_location, | 94 xform_event.set_location_f(xform_location); |
| 92 ui::EventTimeForNow(), event->flags(), | 95 xform_event.set_root_location_f(xform_location); |
| 93 event->changed_button_flags()); | |
| 94 mouse_cb_.Run(&xform_event); | 96 mouse_cb_.Run(&xform_event); |
| 95 event->SetHandled(); | 97 event->SetHandled(); |
| 96 | 98 |
| 97 // If user completed a click we can close the window. | 99 // If user completed a click we can close the window. |
| 98 if (event->type() == ui::EventType::ET_MOUSE_RELEASED) | 100 if (event->type() == ui::EventType::ET_MOUSE_RELEASED) |
| 99 Close(); | 101 Close(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 void LinkDisambiguationPopup::ZoomBubbleView::OnGestureEvent( | 104 void LinkDisambiguationPopup::ZoomBubbleView::OnGestureEvent( |
| 103 ui::GestureEvent* event) { | 105 ui::GestureEvent* event) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void LinkDisambiguationPopup::Close() { | 193 void LinkDisambiguationPopup::Close() { |
| 192 if (view_) { | 194 if (view_) { |
| 193 view_->Close(); | 195 view_->Close(); |
| 194 view_ = NULL; | 196 view_ = NULL; |
| 195 } | 197 } |
| 196 } | 198 } |
| 197 | 199 |
| 198 void LinkDisambiguationPopup::InvalidateBubbleView() { | 200 void LinkDisambiguationPopup::InvalidateBubbleView() { |
| 199 view_ = NULL; | 201 view_ = NULL; |
| 200 } | 202 } |
| OLD | NEW |