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/frame/browser_root_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_root_view.h" |
6 | 6 |
7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int BrowserRootView::OnPerformDrop(const ui::DropTargetEvent& event) { | 89 int BrowserRootView::OnPerformDrop(const ui::DropTargetEvent& event) { |
90 if (!forwarding_to_tab_strip_) | 90 if (!forwarding_to_tab_strip_) |
91 return ui::DragDropTypes::DRAG_NONE; | 91 return ui::DragDropTypes::DRAG_NONE; |
92 | 92 |
93 // Extract the URL and create a new ui::OSExchangeData containing the URL. We | 93 // Extract the URL and create a new ui::OSExchangeData containing the URL. We |
94 // do this as the TabStrip doesn't know about the autocomplete edit and needs | 94 // do this as the TabStrip doesn't know about the autocomplete edit and needs |
95 // to know about it to handle 'paste and go'. | 95 // to know about it to handle 'paste and go'. |
96 GURL url; | 96 GURL url; |
97 base::string16 title; | 97 base::string16 title; |
98 ui::OSExchangeData mapped_data; | 98 ui::OSExchangeData mapped_data; |
99 if (!event.data().GetURLAndTitle(&url, &title) || !url.is_valid()) { | 99 if (!event.data().GetURLAndTitle( |
| 100 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) || |
| 101 !url.is_valid()) { |
100 // The url isn't valid. Use the paste and go url. | 102 // The url isn't valid. Use the paste and go url. |
101 if (GetPasteAndGoURL(event.data(), &url)) | 103 if (GetPasteAndGoURL(event.data(), &url)) |
102 mapped_data.SetURL(url, base::string16()); | 104 mapped_data.SetURL(url, base::string16()); |
103 // else case: couldn't extract a url or 'paste and go' url. This ends up | 105 // else case: couldn't extract a url or 'paste and go' url. This ends up |
104 // passing through an ui::OSExchangeData with nothing in it. We need to do | 106 // passing through an ui::OSExchangeData with nothing in it. We need to do |
105 // this so that the tab strip cleans up properly. | 107 // this so that the tab strip cleans up properly. |
106 } else { | 108 } else { |
107 mapped_data.SetURL(url, base::string16()); | 109 mapped_data.SetURL(url, base::string16()); |
108 } | 110 } |
109 forwarding_to_tab_strip_ = false; | 111 forwarding_to_tab_strip_ = false; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 AutocompleteClassifierFactory::GetForProfile( | 196 AutocompleteClassifierFactory::GetForProfile( |
195 browser_view_->browser()->profile())->Classify(text, false, false, &match, | 197 browser_view_->browser()->profile())->Classify(text, false, false, &match, |
196 NULL); | 198 NULL); |
197 if (!match.destination_url.is_valid()) | 199 if (!match.destination_url.is_valid()) |
198 return false; | 200 return false; |
199 | 201 |
200 if (url) | 202 if (url) |
201 *url = match.destination_url; | 203 *url = match.destination_url; |
202 return true; | 204 return true; |
203 } | 205 } |
OLD | NEW |