OLD | NEW |
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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 if (!plain_text.empty()) | 324 if (!plain_text.empty()) |
325 drop_data->text = base::NullableString16(plain_text, false); | 325 drop_data->text = base::NullableString16(plain_text, false); |
326 | 326 |
327 GURL url; | 327 GURL url; |
328 base::string16 url_title; | 328 base::string16 url_title; |
329 data.GetURLAndTitle( | 329 data.GetURLAndTitle( |
330 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); | 330 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); |
331 if (url.is_valid()) { | 331 if (url.is_valid()) { |
332 drop_data->url = url; | 332 drop_data->url = url; |
333 drop_data->url_title = url_title; | 333 drop_data->url_title = url_title; |
| 334 drop_data->has_url = true; |
334 } | 335 } |
335 | 336 |
336 base::string16 html; | 337 base::string16 html; |
337 GURL html_base_url; | 338 GURL html_base_url; |
338 data.GetHtml(&html, &html_base_url); | 339 data.GetHtml(&html, &html_base_url); |
339 if (!html.empty()) | 340 if (!html.empty()) |
340 drop_data->html = base::NullableString16(html, false); | 341 drop_data->html = base::NullableString16(html, false); |
341 if (html_base_url.is_valid()) | 342 if (html_base_url.is_valid()) |
342 drop_data->html_base_url = html_base_url; | 343 drop_data->html_base_url = html_base_url; |
343 | 344 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 } | 1277 } |
1277 | 1278 |
1278 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 1279 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
1279 DCHECK(current_rvh_for_drag_); | 1280 DCHECK(current_rvh_for_drag_); |
1280 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) | 1281 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) |
1281 OnDragEntered(event); | 1282 OnDragEntered(event); |
1282 | 1283 |
1283 if (!current_drop_data_) | 1284 if (!current_drop_data_) |
1284 return ui::DragDropTypes::DRAG_NONE; | 1285 return ui::DragDropTypes::DRAG_NONE; |
1285 | 1286 |
| 1287 current_drop_data_.reset(new DropData()); |
| 1288 |
| 1289 PrepareDropData(current_drop_data_.get(), event.data()); |
| 1290 |
1286 web_contents_->GetRenderViewHost()->DragTargetDrop( | 1291 web_contents_->GetRenderViewHost()->DragTargetDrop( |
1287 event.location(), gfx::Screen::GetScreen()->GetCursorScreenPoint(), | 1292 *current_drop_data_.get(), event.location(), |
| 1293 gfx::Screen::GetScreen()->GetCursorScreenPoint(), |
1288 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1294 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1289 if (drag_dest_delegate_) | 1295 if (drag_dest_delegate_) |
1290 drag_dest_delegate_->OnDrop(); | 1296 drag_dest_delegate_->OnDrop(); |
1291 current_drop_data_.reset(); | 1297 current_drop_data_.reset(); |
1292 return ConvertFromWeb(current_drag_op_); | 1298 return ConvertFromWeb(current_drag_op_); |
1293 } | 1299 } |
1294 | 1300 |
1295 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, | 1301 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, |
1296 bool visible) { | 1302 bool visible) { |
1297 // Ignore any visibility changes in the hierarchy below. | 1303 // Ignore any visibility changes in the hierarchy below. |
(...skipping 20 matching lines...) Expand all Loading... |
1318 if (visible) { | 1324 if (visible) { |
1319 if (!web_contents_->should_normally_be_visible()) | 1325 if (!web_contents_->should_normally_be_visible()) |
1320 web_contents_->WasShown(); | 1326 web_contents_->WasShown(); |
1321 } else { | 1327 } else { |
1322 if (web_contents_->should_normally_be_visible()) | 1328 if (web_contents_->should_normally_be_visible()) |
1323 web_contents_->WasHidden(); | 1329 web_contents_->WasHidden(); |
1324 } | 1330 } |
1325 } | 1331 } |
1326 | 1332 |
1327 } // namespace content | 1333 } // namespace content |
OLD | NEW |