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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 provider->SetURL(drop_data.url, drop_data.url_title); | 274 provider->SetURL(drop_data.url, drop_data.url_title); |
275 if (!drop_data.html.string().empty()) | 275 if (!drop_data.html.string().empty()) |
276 provider->SetHtml(drop_data.html.string(), drop_data.html_base_url); | 276 provider->SetHtml(drop_data.html.string(), drop_data.html_base_url); |
277 if (!drop_data.filenames.empty()) { | 277 if (!drop_data.filenames.empty()) { |
278 std::vector<ui::OSExchangeData::FileInfo> filenames; | 278 std::vector<ui::OSExchangeData::FileInfo> filenames; |
279 for (std::vector<DropData::FileInfo>::const_iterator it = | 279 for (std::vector<DropData::FileInfo>::const_iterator it = |
280 drop_data.filenames.begin(); | 280 drop_data.filenames.begin(); |
281 it != drop_data.filenames.end(); ++it) { | 281 it != drop_data.filenames.end(); ++it) { |
282 filenames.push_back( | 282 filenames.push_back( |
283 ui::OSExchangeData::FileInfo( | 283 ui::OSExchangeData::FileInfo( |
284 base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(it->path)), | 284 base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(it->path)), |
285 base::FilePath::FromUTF8Unsafe(UTF16ToUTF8(it->display_name)))); | 285 base::FilePath::FromUTF8Unsafe( |
| 286 base::UTF16ToUTF8(it->display_name)))); |
286 } | 287 } |
287 provider->SetFilenames(filenames); | 288 provider->SetFilenames(filenames); |
288 } | 289 } |
289 if (!drop_data.custom_data.empty()) { | 290 if (!drop_data.custom_data.empty()) { |
290 Pickle pickle; | 291 Pickle pickle; |
291 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); | 292 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); |
292 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), | 293 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), |
293 pickle); | 294 pickle); |
294 } | 295 } |
295 } | 296 } |
(...skipping 20 matching lines...) Expand all Loading... |
316 drop_data->html = base::NullableString16(html, false); | 317 drop_data->html = base::NullableString16(html, false); |
317 if (html_base_url.is_valid()) | 318 if (html_base_url.is_valid()) |
318 drop_data->html_base_url = html_base_url; | 319 drop_data->html_base_url = html_base_url; |
319 | 320 |
320 std::vector<ui::OSExchangeData::FileInfo> files; | 321 std::vector<ui::OSExchangeData::FileInfo> files; |
321 if (data.GetFilenames(&files) && !files.empty()) { | 322 if (data.GetFilenames(&files) && !files.empty()) { |
322 for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator | 323 for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator |
323 it = files.begin(); it != files.end(); ++it) { | 324 it = files.begin(); it != files.end(); ++it) { |
324 drop_data->filenames.push_back( | 325 drop_data->filenames.push_back( |
325 DropData::FileInfo( | 326 DropData::FileInfo( |
326 UTF8ToUTF16(it->path.AsUTF8Unsafe()), | 327 base::UTF8ToUTF16(it->path.AsUTF8Unsafe()), |
327 UTF8ToUTF16(it->display_name.AsUTF8Unsafe()))); | 328 base::UTF8ToUTF16(it->display_name.AsUTF8Unsafe()))); |
328 } | 329 } |
329 } | 330 } |
330 | 331 |
331 Pickle pickle; | 332 Pickle pickle; |
332 if (data.GetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), &pickle)) | 333 if (data.GetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), &pickle)) |
333 ui::ReadCustomDataIntoMap( | 334 ui::ReadCustomDataIntoMap( |
334 pickle.data(), pickle.size(), &drop_data->custom_data); | 335 pickle.data(), pickle.size(), &drop_data->custom_data); |
335 } | 336 } |
336 | 337 |
337 // Utilities to convert between blink::WebDragOperationsMask and | 338 // Utilities to convert between blink::WebDragOperationsMask and |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 event.location(), | 1722 event.location(), |
1722 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1723 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1723 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1724 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1724 if (drag_dest_delegate_) | 1725 if (drag_dest_delegate_) |
1725 drag_dest_delegate_->OnDrop(); | 1726 drag_dest_delegate_->OnDrop(); |
1726 current_drop_data_.reset(); | 1727 current_drop_data_.reset(); |
1727 return current_drag_op_; | 1728 return current_drag_op_; |
1728 } | 1729 } |
1729 | 1730 |
1730 } // namespace content | 1731 } // namespace content |
OLD | NEW |