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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 *formats = *formats | ui::OSExchangeData::URL; | 850 *formats = *formats | ui::OSExchangeData::URL; |
851 } | 851 } |
852 | 852 |
853 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { | 853 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { |
854 if (HasTextBeingDragged()) | 854 if (HasTextBeingDragged()) |
855 return ui::DragDropTypes::DRAG_NONE; | 855 return ui::DragDropTypes::DRAG_NONE; |
856 | 856 |
857 if (data.HasURL()) { | 857 if (data.HasURL()) { |
858 GURL url; | 858 GURL url; |
859 base::string16 title; | 859 base::string16 title; |
860 if (data.GetURLAndTitle(&url, &title)) { | 860 if (data.GetURLAndTitle( |
| 861 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) { |
861 base::string16 text( | 862 base::string16 text( |
862 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); | 863 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); |
863 if (model()->CanPasteAndGo(text)) { | 864 if (model()->CanPasteAndGo(text)) { |
864 model()->PasteAndGo(text); | 865 model()->PasteAndGo(text); |
865 return ui::DragDropTypes::DRAG_COPY; | 866 return ui::DragDropTypes::DRAG_COPY; |
866 } | 867 } |
867 } | 868 } |
868 } else if (data.HasString()) { | 869 } else if (data.HasString()) { |
869 base::string16 text; | 870 base::string16 text; |
870 if (data.GetString(&text)) { | 871 if (data.GetString(&text)) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 const base::string16 text(GetClipboardText()); | 976 const base::string16 text(GetClipboardText()); |
976 if (!text.empty()) { | 977 if (!text.empty()) { |
977 // Record this paste, so we can do different behavior. | 978 // Record this paste, so we can do different behavior. |
978 model()->OnPaste(); | 979 model()->OnPaste(); |
979 // Force a Paste operation to trigger the text_changed code in | 980 // Force a Paste operation to trigger the text_changed code in |
980 // OnAfterPossibleChange(), even if identical contents are pasted. | 981 // OnAfterPossibleChange(), even if identical contents are pasted. |
981 text_before_change_.clear(); | 982 text_before_change_.clear(); |
982 InsertOrReplaceText(text); | 983 InsertOrReplaceText(text); |
983 } | 984 } |
984 } | 985 } |
OLD | NEW |