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/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/renderer_host/dip_util.h" | 10 #include "content/browser/renderer_host/dip_util.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 pickle); | 255 pickle); |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 // Utility to fill a WebDropData object from ui::OSExchangeData. | 259 // Utility to fill a WebDropData object from ui::OSExchangeData. |
260 void PrepareWebDropData(WebDropData* drop_data, | 260 void PrepareWebDropData(WebDropData* drop_data, |
261 const ui::OSExchangeData& data) { | 261 const ui::OSExchangeData& data) { |
262 string16 plain_text; | 262 string16 plain_text; |
263 data.GetString(&plain_text); | 263 data.GetString(&plain_text); |
264 if (!plain_text.empty()) | 264 if (!plain_text.empty()) |
265 drop_data->text = NullableString16(plain_text, false); | 265 drop_data->text = base::NullableString16(plain_text, false); |
266 | 266 |
267 GURL url; | 267 GURL url; |
268 string16 url_title; | 268 string16 url_title; |
269 data.GetURLAndTitle(&url, &url_title); | 269 data.GetURLAndTitle(&url, &url_title); |
270 if (url.is_valid()) { | 270 if (url.is_valid()) { |
271 drop_data->url = url; | 271 drop_data->url = url; |
272 drop_data->url_title = url_title; | 272 drop_data->url_title = url_title; |
273 } | 273 } |
274 | 274 |
275 string16 html; | 275 string16 html; |
276 GURL html_base_url; | 276 GURL html_base_url; |
277 data.GetHtml(&html, &html_base_url); | 277 data.GetHtml(&html, &html_base_url); |
278 if (!html.empty()) | 278 if (!html.empty()) |
279 drop_data->html = NullableString16(html, false); | 279 drop_data->html = base::NullableString16(html, false); |
280 if (html_base_url.is_valid()) | 280 if (html_base_url.is_valid()) |
281 drop_data->html_base_url = html_base_url; | 281 drop_data->html_base_url = html_base_url; |
282 | 282 |
283 std::vector<ui::OSExchangeData::FileInfo> files; | 283 std::vector<ui::OSExchangeData::FileInfo> files; |
284 if (data.GetFilenames(&files) && !files.empty()) { | 284 if (data.GetFilenames(&files) && !files.empty()) { |
285 for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator | 285 for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator |
286 it = files.begin(); it != files.end(); ++it) { | 286 it = files.begin(); it != files.end(); ++it) { |
287 drop_data->filenames.push_back( | 287 drop_data->filenames.push_back( |
288 WebDropData::FileInfo( | 288 WebDropData::FileInfo( |
289 UTF8ToUTF16(it->path.AsUTF8Unsafe()), | 289 UTF8ToUTF16(it->path.AsUTF8Unsafe()), |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 event.location(), | 1417 event.location(), |
1418 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1418 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1419 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1419 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1420 if (drag_dest_delegate_) | 1420 if (drag_dest_delegate_) |
1421 drag_dest_delegate_->OnDrop(); | 1421 drag_dest_delegate_->OnDrop(); |
1422 current_drop_data_.reset(); | 1422 current_drop_data_.reset(); |
1423 return current_drag_op_; | 1423 return current_drag_op_; |
1424 } | 1424 } |
1425 | 1425 |
1426 } // namespace content | 1426 } // namespace content |
OLD | NEW |