| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <shlobj.h> | 6 #include <shlobj.h> |
| 7 | 7 |
| 8 #include "chrome/browser/web_drop_target.h" | 8 #include "chrome/browser/web_drop_target.h" |
| 9 | 9 |
| 10 #include "base/clipboard_util.h" | 10 #include "base/clipboard_util.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 WebDropData drop_data; | 99 WebDropData drop_data; |
| 100 WebDropData::PopulateWebDropData(data_object, &drop_data); | 100 WebDropData::PopulateWebDropData(data_object, &drop_data); |
| 101 | 101 |
| 102 if (drop_data.url.is_empty()) | 102 if (drop_data.url.is_empty()) |
| 103 OSExchangeData::GetPlainTextURL(data_object, &drop_data.url); | 103 OSExchangeData::GetPlainTextURL(data_object, &drop_data.url); |
| 104 | 104 |
| 105 is_drop_target_ = true; | 105 is_drop_target_ = true; |
| 106 | 106 |
| 107 POINT client_pt = cursor_position; | 107 POINT client_pt = cursor_position; |
| 108 ScreenToClient(GetHWND(), &client_pt); | 108 ScreenToClient(GetHWND(), &client_pt); |
| 109 web_contents_->DragTargetDragEnter(drop_data, | 109 web_contents_->render_view_host()->DragTargetDragEnter(drop_data, |
| 110 gfx::Point(client_pt.x, client_pt.y), | 110 gfx::Point(client_pt.x, client_pt.y), |
| 111 gfx::Point(cursor_position.x, cursor_position.y)); | 111 gfx::Point(cursor_position.x, cursor_position.y)); |
| 112 | 112 |
| 113 // We lie here and always return a DROPEFFECT because we don't want to | 113 // We lie here and always return a DROPEFFECT because we don't want to |
| 114 // wait for the IPC call to return. | 114 // wait for the IPC call to return. |
| 115 return GetPreferredDropEffect(effect); | 115 return GetPreferredDropEffect(effect); |
| 116 } | 116 } |
| 117 | 117 |
| 118 DWORD WebDropTarget::OnDragOver(IDataObject* data_object, | 118 DWORD WebDropTarget::OnDragOver(IDataObject* data_object, |
| 119 DWORD key_state, | 119 DWORD key_state, |
| 120 POINT cursor_position, | 120 POINT cursor_position, |
| 121 DWORD effect) { | 121 DWORD effect) { |
| 122 if (web_contents_->showing_interstitial_page()) | 122 if (web_contents_->showing_interstitial_page()) |
| 123 return interstitial_drop_target_->OnDragOver(data_object, effect); | 123 return interstitial_drop_target_->OnDragOver(data_object, effect); |
| 124 | 124 |
| 125 POINT client_pt = cursor_position; | 125 POINT client_pt = cursor_position; |
| 126 ScreenToClient(GetHWND(), &client_pt); | 126 ScreenToClient(GetHWND(), &client_pt); |
| 127 web_contents_->DragTargetDragOver( | 127 web_contents_->render_view_host()->DragTargetDragOver( |
| 128 gfx::Point(client_pt.x, client_pt.y), | 128 gfx::Point(client_pt.x, client_pt.y), |
| 129 gfx::Point(cursor_position.x, cursor_position.y)); | 129 gfx::Point(cursor_position.x, cursor_position.y)); |
| 130 | 130 |
| 131 if (!is_drop_target_) | 131 if (!is_drop_target_) |
| 132 return DROPEFFECT_NONE; | 132 return DROPEFFECT_NONE; |
| 133 | 133 |
| 134 return GetPreferredDropEffect(effect); | 134 return GetPreferredDropEffect(effect); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void WebDropTarget::OnDragLeave(IDataObject* data_object) { | 137 void WebDropTarget::OnDragLeave(IDataObject* data_object) { |
| 138 if (web_contents_->showing_interstitial_page()) { | 138 if (web_contents_->showing_interstitial_page()) { |
| 139 interstitial_drop_target_->OnDragLeave(data_object); | 139 interstitial_drop_target_->OnDragLeave(data_object); |
| 140 } else { | 140 } else { |
| 141 web_contents_->DragTargetDragLeave(); | 141 web_contents_->render_view_host()->DragTargetDragLeave(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| 146 DWORD WebDropTarget::OnDrop(IDataObject* data_object, | 146 DWORD WebDropTarget::OnDrop(IDataObject* data_object, |
| 147 DWORD key_state, | 147 DWORD key_state, |
| 148 POINT cursor_position, | 148 POINT cursor_position, |
| 149 DWORD effect) { | 149 DWORD effect) { |
| 150 if (web_contents_->showing_interstitial_page()) | 150 if (web_contents_->showing_interstitial_page()) |
| 151 return interstitial_drop_target_->OnDrop(data_object, effect); | 151 return interstitial_drop_target_->OnDrop(data_object, effect); |
| 152 | 152 |
| 153 POINT client_pt = cursor_position; | 153 POINT client_pt = cursor_position; |
| 154 ScreenToClient(GetHWND(), &client_pt); | 154 ScreenToClient(GetHWND(), &client_pt); |
| 155 web_contents_->DragTargetDrop( | 155 web_contents_->render_view_host()->DragTargetDrop( |
| 156 gfx::Point(client_pt.x, client_pt.y), | 156 gfx::Point(client_pt.x, client_pt.y), |
| 157 gfx::Point(cursor_position.x, cursor_position.y)); | 157 gfx::Point(cursor_position.x, cursor_position.y)); |
| 158 | 158 |
| 159 // We lie and always claim that the drop operation didn't happen because we | 159 // We lie and always claim that the drop operation didn't happen because we |
| 160 // don't want to wait for the renderer to respond. | 160 // don't want to wait for the renderer to respond. |
| 161 return DROPEFFECT_NONE; | 161 return DROPEFFECT_NONE; |
| 162 } | 162 } |
| 163 | 163 |
| OLD | NEW |