| 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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 *formats = *formats | ui::OSExchangeData::URL; | 798 *formats = *formats | ui::OSExchangeData::URL; |
| 799 } | 799 } |
| 800 | 800 |
| 801 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { | 801 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { |
| 802 if (HasTextBeingDragged()) | 802 if (HasTextBeingDragged()) |
| 803 return ui::DragDropTypes::DRAG_NONE; | 803 return ui::DragDropTypes::DRAG_NONE; |
| 804 | 804 |
| 805 if (data.HasURL()) { | 805 if (data.HasURL()) { |
| 806 GURL url; | 806 GURL url; |
| 807 base::string16 title; | 807 base::string16 title; |
| 808 if (data.GetURLAndTitle(&url, &title)) { | 808 if (data.GetURLAndTitle( |
| 809 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) { |
| 809 base::string16 text(StripJavascriptSchemas(UTF8ToUTF16(url.spec()))); | 810 base::string16 text(StripJavascriptSchemas(UTF8ToUTF16(url.spec()))); |
| 810 if (model()->CanPasteAndGo(text)) { | 811 if (model()->CanPasteAndGo(text)) { |
| 811 model()->PasteAndGo(text); | 812 model()->PasteAndGo(text); |
| 812 return ui::DragDropTypes::DRAG_COPY; | 813 return ui::DragDropTypes::DRAG_COPY; |
| 813 } | 814 } |
| 814 } | 815 } |
| 815 } else if (data.HasString()) { | 816 } else if (data.HasString()) { |
| 816 base::string16 text; | 817 base::string16 text; |
| 817 if (data.GetString(&text)) { | 818 if (data.GetString(&text)) { |
| 818 base::string16 collapsed_text(CollapseWhitespace(text, true)); | 819 base::string16 collapsed_text(CollapseWhitespace(text, true)); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 const base::string16 text(GetClipboardText()); | 973 const base::string16 text(GetClipboardText()); |
| 973 if (!text.empty()) { | 974 if (!text.empty()) { |
| 974 // Record this paste, so we can do different behavior. | 975 // Record this paste, so we can do different behavior. |
| 975 model()->OnPaste(); | 976 model()->OnPaste(); |
| 976 // Force a Paste operation to trigger the text_changed code in | 977 // Force a Paste operation to trigger the text_changed code in |
| 977 // OnAfterPossibleChange(), even if identical contents are pasted. | 978 // OnAfterPossibleChange(), even if identical contents are pasted. |
| 978 text_before_change_.clear(); | 979 text_before_change_.clear(); |
| 979 InsertOrReplaceText(text); | 980 InsertOrReplaceText(text); |
| 980 } | 981 } |
| 981 } | 982 } |
| OLD | NEW |