| 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 "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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 void OmniboxViewViews::AppendDropFormats( | 1037 void OmniboxViewViews::AppendDropFormats( |
| 1038 int* formats, | 1038 int* formats, |
| 1039 std::set<ui::Clipboard::FormatType>* format_types) { | 1039 std::set<ui::Clipboard::FormatType>* format_types) { |
| 1040 *formats = *formats | ui::OSExchangeData::URL; | 1040 *formats = *formats | ui::OSExchangeData::URL; |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { | 1043 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { |
| 1044 if (HasTextBeingDragged()) | 1044 if (HasTextBeingDragged()) |
| 1045 return ui::DragDropTypes::DRAG_NONE; | 1045 return ui::DragDropTypes::DRAG_NONE; |
| 1046 | 1046 |
| 1047 if (data.HasURL(ui::OSExchangeData::CONVERT_FILENAMES)) { | 1047 if (data.HasURL(ui::OSExchangeData::CONVERT_FILENAMES, |
| 1048 ui::OSExchangeData::DO_NOT_PARSE_TEXT_AS_URL)) { |
| 1048 GURL url; | 1049 GURL url; |
| 1049 base::string16 title; | 1050 base::string16 title; |
| 1050 if (data.GetURLAndTitle( | 1051 if (data.GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES, |
| 1051 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) { | 1052 ui::OSExchangeData::DO_NOT_PARSE_TEXT_AS_URL, &url, |
| 1053 &title)) { |
| 1052 base::string16 text( | 1054 base::string16 text( |
| 1053 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); | 1055 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); |
| 1054 if (model()->CanPasteAndGo(text)) { | 1056 if (model()->CanPasteAndGo(text)) { |
| 1055 model()->PasteAndGo(text); | 1057 model()->PasteAndGo(text); |
| 1056 return ui::DragDropTypes::DRAG_COPY; | 1058 return ui::DragDropTypes::DRAG_COPY; |
| 1057 } | 1059 } |
| 1058 } | 1060 } |
| 1059 } else if (data.HasString()) { | 1061 } else if (data.HasString()) { |
| 1060 base::string16 text; | 1062 base::string16 text; |
| 1061 if (data.GetString(&text)) { | 1063 if (data.GetString(&text)) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1076 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); | 1078 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); |
| 1077 | 1079 |
| 1078 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); | 1080 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); |
| 1079 | 1081 |
| 1080 // Minor note: We use IDC_ for command id here while the underlying textfield | 1082 // Minor note: We use IDC_ for command id here while the underlying textfield |
| 1081 // is using IDS_ for all its command ids. This is because views cannot depend | 1083 // is using IDS_ for all its command ids. This is because views cannot depend |
| 1082 // on IDC_ for now. | 1084 // on IDC_ for now. |
| 1083 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1085 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
| 1084 IDS_EDIT_SEARCH_ENGINES); | 1086 IDS_EDIT_SEARCH_ENGINES); |
| 1085 } | 1087 } |
| OLD | NEW |