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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2014733003: Removing parsing of text from pasteboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moving url parsing up the hierarchy Created 4 years, 6 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 void OmniboxViewViews::AppendDropFormats( 1036 void OmniboxViewViews::AppendDropFormats(
1037 int* formats, 1037 int* formats,
1038 std::set<ui::Clipboard::FormatType>* format_types) { 1038 std::set<ui::Clipboard::FormatType>* format_types) {
1039 *formats = *formats | ui::OSExchangeData::URL; 1039 *formats = *formats | ui::OSExchangeData::URL;
1040 } 1040 }
1041 1041
1042 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { 1042 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) {
1043 if (HasTextBeingDragged()) 1043 if (HasTextBeingDragged())
1044 return ui::DragDropTypes::DRAG_NONE; 1044 return ui::DragDropTypes::DRAG_NONE;
1045 1045
1046 if (data.HasURL(ui::OSExchangeData::CONVERT_FILENAMES)) { 1046 if (data.HasURL(ui::OSExchangeData::CONVERT_FILENAMES,
1047 ui::OSExchangeData::DO_NOT_PARSE_TEXT_AS_URL)) {
1047 GURL url; 1048 GURL url;
1048 base::string16 title; 1049 base::string16 title;
1049 if (data.GetURLAndTitle( 1050 if (data.GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES,
1050 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) { 1051 ui::OSExchangeData::DO_NOT_PARSE_TEXT_AS_URL, &url,
1052 &title)) {
1051 base::string16 text( 1053 base::string16 text(
1052 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); 1054 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec())));
1053 if (model()->CanPasteAndGo(text)) { 1055 if (model()->CanPasteAndGo(text)) {
1054 model()->PasteAndGo(text); 1056 model()->PasteAndGo(text);
1055 return ui::DragDropTypes::DRAG_COPY; 1057 return ui::DragDropTypes::DRAG_COPY;
1056 } 1058 }
1057 } 1059 }
1058 } else if (data.HasString()) { 1060 } else if (data.HasString()) {
1059 base::string16 text; 1061 base::string16 text;
1060 if (data.GetString(&text)) { 1062 if (data.GetString(&text)) {
(...skipping 22 matching lines...) Expand all
1083 menu_contents->InsertItemWithStringIdAt( 1085 menu_contents->InsertItemWithStringIdAt(
1084 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); 1086 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL);
1085 } 1087 }
1086 1088
1087 // Minor note: We use IDC_ for command id here while the underlying textfield 1089 // Minor note: We use IDC_ for command id here while the underlying textfield
1088 // is using IDS_ for all its command ids. This is because views cannot depend 1090 // is using IDS_ for all its command ids. This is because views cannot depend
1089 // on IDC_ for now. 1091 // on IDC_ for now.
1090 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1092 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1091 IDS_EDIT_SEARCH_ENGINES); 1093 IDS_EDIT_SEARCH_ENGINES);
1092 } 1094 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698