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

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

Issue 135633002: Don't populate URL data in WebDropData when dragging files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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 "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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 *formats = *formats | ui::OSExchangeData::URL; 800 *formats = *formats | ui::OSExchangeData::URL;
801 } 801 }
802 802
803 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) { 803 int OmniboxViewViews::OnDrop(const ui::OSExchangeData& data) {
804 if (HasTextBeingDragged()) 804 if (HasTextBeingDragged())
805 return ui::DragDropTypes::DRAG_NONE; 805 return ui::DragDropTypes::DRAG_NONE;
806 806
807 if (data.HasURL()) { 807 if (data.HasURL()) {
808 GURL url; 808 GURL url;
809 base::string16 title; 809 base::string16 title;
810 if (data.GetURLAndTitle(&url, &title)) { 810 if (data.GetURLAndTitle(
811 ui::OSExchangeData::ConvertFilenames, &url, &title)) {
811 base::string16 text( 812 base::string16 text(
812 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); 813 StripJavascriptSchemas(base::UTF8ToUTF16(url.spec())));
813 if (model()->CanPasteAndGo(text)) { 814 if (model()->CanPasteAndGo(text)) {
814 model()->PasteAndGo(text); 815 model()->PasteAndGo(text);
815 return ui::DragDropTypes::DRAG_COPY; 816 return ui::DragDropTypes::DRAG_COPY;
816 } 817 }
817 } 818 }
818 } else if (data.HasString()) { 819 } else if (data.HasString()) {
819 base::string16 text; 820 base::string16 text;
820 if (data.GetString(&text)) { 821 if (data.GetString(&text)) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698