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

Side by Side Diff: ui/views/widget/drop_helper.cc

Issue 1421713002: Explicitly convert Point to PointF for event code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wip
Patch Set: pointfconvert-prod: . Created 5 years, 1 month 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/widget/drop_helper.h" 5 #include "ui/views/widget/drop_helper.h"
6 6
7 #include "ui/base/dragdrop/drag_drop_types.h" 7 #include "ui/base/dragdrop/drag_drop_types.h"
8 #include "ui/views/view.h" 8 #include "ui/views/view.h"
9 #include "ui/views/widget/widget.h" 9 #include "ui/views/widget/widget.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return ui::DragDropTypes::DRAG_NONE; 56 return ui::DragDropTypes::DRAG_NONE;
57 57
58 if (drag_operation == ui::DragDropTypes::DRAG_NONE) { 58 if (drag_operation == ui::DragDropTypes::DRAG_NONE) {
59 drop_view->OnDragExited(); 59 drop_view->OnDragExited();
60 return ui::DragDropTypes::DRAG_NONE; 60 return ui::DragDropTypes::DRAG_NONE;
61 } 61 }
62 62
63 gfx::Point view_location(root_view_location); 63 gfx::Point view_location(root_view_location);
64 View* root_view = drop_view->GetWidget()->GetRootView(); 64 View* root_view = drop_view->GetWidget()->GetRootView();
65 View::ConvertPointToTarget(root_view, drop_view, &view_location); 65 View::ConvertPointToTarget(root_view, drop_view, &view_location);
66 ui::DropTargetEvent drop_event(data, view_location, view_location, 66 ui::DropTargetEvent drop_event(data, gfx::PointF(view_location),
67 drag_operation); 67 gfx::PointF(view_location), drag_operation);
68 return drop_view->OnPerformDrop(drop_event); 68 return drop_view->OnPerformDrop(drop_event);
69 } 69 }
70 70
71 View* DropHelper::CalculateTargetView( 71 View* DropHelper::CalculateTargetView(
72 const gfx::Point& root_view_location, 72 const gfx::Point& root_view_location,
73 const OSExchangeData& data, 73 const OSExchangeData& data,
74 bool check_can_drop) { 74 bool check_can_drop) {
75 return CalculateTargetViewImpl(root_view_location, data, check_can_drop, 75 return CalculateTargetViewImpl(root_view_location, data, check_can_drop,
76 NULL); 76 NULL);
77 } 77 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 void DropHelper::NotifyDragEntered(const OSExchangeData& data, 121 void DropHelper::NotifyDragEntered(const OSExchangeData& data,
122 const gfx::Point& root_view_location, 122 const gfx::Point& root_view_location,
123 int drag_operation) { 123 int drag_operation) {
124 if (!target_view_) 124 if (!target_view_)
125 return; 125 return;
126 126
127 gfx::Point target_view_location(root_view_location); 127 gfx::Point target_view_location(root_view_location);
128 View::ConvertPointToTarget(root_view_, target_view_, &target_view_location); 128 View::ConvertPointToTarget(root_view_, target_view_, &target_view_location);
129 ui::DropTargetEvent enter_event(data, 129 ui::DropTargetEvent enter_event(data, gfx::PointF(target_view_location),
130 target_view_location, 130 gfx::PointF(target_view_location),
131 target_view_location,
132 drag_operation); 131 drag_operation);
133 target_view_->OnDragEntered(enter_event); 132 target_view_->OnDragEntered(enter_event);
134 } 133 }
135 134
136 int DropHelper::NotifyDragOver(const OSExchangeData& data, 135 int DropHelper::NotifyDragOver(const OSExchangeData& data,
137 const gfx::Point& root_view_location, 136 const gfx::Point& root_view_location,
138 int drag_operation) { 137 int drag_operation) {
139 if (!target_view_) 138 if (!target_view_)
140 return ui::DragDropTypes::DRAG_NONE; 139 return ui::DragDropTypes::DRAG_NONE;
141 140
142 gfx::Point target_view_location(root_view_location); 141 gfx::Point target_view_location(root_view_location);
143 View::ConvertPointToTarget(root_view_, target_view_, &target_view_location); 142 View::ConvertPointToTarget(root_view_, target_view_, &target_view_location);
144 ui::DropTargetEvent enter_event(data, 143 ui::DropTargetEvent enter_event(data, gfx::PointF(target_view_location),
145 target_view_location, 144 gfx::PointF(target_view_location),
146 target_view_location,
147 drag_operation); 145 drag_operation);
148 return target_view_->OnDragUpdated(enter_event); 146 return target_view_->OnDragUpdated(enter_event);
149 } 147 }
150 148
151 void DropHelper::NotifyDragExit() { 149 void DropHelper::NotifyDragExit() {
152 if (target_view_) 150 if (target_view_)
153 target_view_->OnDragExited(); 151 target_view_->OnDragExited();
154 } 152 }
155 153
156 } // namespace views 154 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698