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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 2322253004: Drag and dropping text, parsable as url (Closed)
Patch Set: Moving url logic out of os_exchange_data Created 4 years, 3 months 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 "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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "ui/aura/client/aura_constants.h" 48 #include "ui/aura/client/aura_constants.h"
49 #include "ui/aura/client/screen_position_client.h" 49 #include "ui/aura/client/screen_position_client.h"
50 #include "ui/aura/client/window_tree_client.h" 50 #include "ui/aura/client/window_tree_client.h"
51 #include "ui/aura/env.h" 51 #include "ui/aura/env.h"
52 #include "ui/aura/window.h" 52 #include "ui/aura/window.h"
53 #include "ui/aura/window_observer.h" 53 #include "ui/aura/window_observer.h"
54 #include "ui/aura/window_tree_host.h" 54 #include "ui/aura/window_tree_host.h"
55 #include "ui/aura/window_tree_host_observer.h" 55 #include "ui/aura/window_tree_host_observer.h"
56 #include "ui/base/clipboard/clipboard.h" 56 #include "ui/base/clipboard/clipboard.h"
57 #include "ui/base/clipboard/custom_data_helper.h" 57 #include "ui/base/clipboard/custom_data_helper.h"
58 #include "ui/base/dragdrop/drag_and_drop_url_utils.h"
58 #include "ui/base/dragdrop/drag_drop_types.h" 59 #include "ui/base/dragdrop/drag_drop_types.h"
59 #include "ui/base/dragdrop/drag_utils.h" 60 #include "ui/base/dragdrop/drag_utils.h"
60 #include "ui/base/dragdrop/drop_target_event.h" 61 #include "ui/base/dragdrop/drop_target_event.h"
61 #include "ui/base/dragdrop/os_exchange_data.h" 62 #include "ui/base/dragdrop/os_exchange_data.h"
62 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" 63 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
63 #include "ui/base/hit_test.h" 64 #include "ui/base/hit_test.h"
64 #include "ui/compositor/layer.h" 65 #include "ui/compositor/layer.h"
65 #include "ui/display/screen.h" 66 #include "ui/display/screen.h"
66 #include "ui/events/blink/web_input_event.h" 67 #include "ui/events/blink/web_input_event.h"
67 #include "ui/events/event.h" 68 #include "ui/events/event.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 320
320 // Utility to fill a DropData object from ui::OSExchangeData. 321 // Utility to fill a DropData object from ui::OSExchangeData.
321 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { 322 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) {
322 drop_data->did_originate_from_renderer = data.DidOriginateFromRenderer(); 323 drop_data->did_originate_from_renderer = data.DidOriginateFromRenderer();
323 324
324 base::string16 plain_text; 325 base::string16 plain_text;
325 data.GetString(&plain_text); 326 data.GetString(&plain_text);
326 if (!plain_text.empty()) 327 if (!plain_text.empty())
327 drop_data->text = base::NullableString16(plain_text, false); 328 drop_data->text = base::NullableString16(plain_text, false);
328 329
329 GURL url; 330 if (auto url_and_title = ui::TryToInterpretAsURL(
330 base::string16 url_title; 331 data, ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES)) {
331 data.GetURLAndTitle( 332 if (url_and_title->first.is_valid()) {
332 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); 333 drop_data->url = std::move(url_and_title->first);
333 if (url.is_valid()) { 334 drop_data->url_title = std::move(url_and_title->second);
334 drop_data->url = url; 335 }
335 drop_data->url_title = url_title;
336 } 336 }
337 337
338 base::string16 html; 338 base::string16 html;
339 GURL html_base_url; 339 GURL html_base_url;
340 data.GetHtml(&html, &html_base_url); 340 data.GetHtml(&html, &html_base_url);
341 if (!html.empty()) 341 if (!html.empty())
342 drop_data->html = base::NullableString16(html, false); 342 drop_data->html = base::NullableString16(html, false);
343 if (html_base_url.is_valid()) 343 if (html_base_url.is_valid())
344 drop_data->html_base_url = html_base_url; 344 drop_data->html_base_url = html_base_url;
345 345
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 bool allow_multiple_selection) { 1212 bool allow_multiple_selection) {
1213 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; 1213 NOTIMPLEMENTED() << " show " << items.size() << " menu items";
1214 } 1214 }
1215 1215
1216 void WebContentsViewAura::HidePopupMenu() { 1216 void WebContentsViewAura::HidePopupMenu() {
1217 NOTIMPLEMENTED(); 1217 NOTIMPLEMENTED();
1218 } 1218 }
1219 #endif 1219 #endif
1220 1220
1221 } // namespace content 1221 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698