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 "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/message_loop/message_pump_x11.h" | 9 #include "base/message_loop/message_pump_x11.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (data.IsValid()) { | 190 if (data.IsValid()) { |
191 std::string text = data.GetText(); | 191 std::string text = data.GetText(); |
192 *result = base::UTF8ToUTF16(text); | 192 *result = base::UTF8ToUTF16(text); |
193 return true; | 193 return true; |
194 } | 194 } |
195 | 195 |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 bool OSExchangeDataProviderAuraX11::GetURLAndTitle( | 199 bool OSExchangeDataProviderAuraX11::GetURLAndTitle( |
| 200 OSExchangeData::FilenameToURLPolicy policy, |
200 GURL* url, | 201 GURL* url, |
201 base::string16* title) const { | 202 base::string16* title) const { |
202 std::vector< ::Atom> url_atoms = ui::GetURLAtomsFrom(&atom_cache_); | 203 std::vector< ::Atom> url_atoms = ui::GetURLAtomsFrom(&atom_cache_); |
203 std::vector< ::Atom> requested_types; | 204 std::vector< ::Atom> requested_types; |
204 ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types); | 205 ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types); |
205 | 206 |
206 ui::SelectionData data(format_map_.GetFirstOf(requested_types)); | 207 ui::SelectionData data(format_map_.GetFirstOf(requested_types)); |
207 if (data.IsValid()) { | 208 if (data.IsValid()) { |
208 // TODO(erg): Technically, both of these forms can accept multiple URLs, | 209 // TODO(erg): Technically, both of these forms can accept multiple URLs, |
209 // but that doesn't match the assumptions of the rest of the system which | 210 // but that doesn't match the assumptions of the rest of the system which |
(...skipping 14 matching lines...) Expand all Loading... |
224 | 225 |
225 *url = GURL(tokens[0]); | 226 *url = GURL(tokens[0]); |
226 return true; | 227 return true; |
227 } | 228 } |
228 } else if (data.GetType() == atom_cache_.GetAtom( | 229 } else if (data.GetType() == atom_cache_.GetAtom( |
229 Clipboard::kMimeTypeURIList)) { | 230 Clipboard::kMimeTypeURIList)) { |
230 std::vector<std::string> tokens = ui::ParseURIList(data); | 231 std::vector<std::string> tokens = ui::ParseURIList(data); |
231 for (std::vector<std::string>::const_iterator it = tokens.begin(); | 232 for (std::vector<std::string>::const_iterator it = tokens.begin(); |
232 it != tokens.end(); ++it) { | 233 it != tokens.end(); ++it) { |
233 GURL test_url(*it); | 234 GURL test_url(*it); |
234 if (!test_url.SchemeIsFile()) { | 235 if (!test_url.SchemeIsFile() || |
| 236 policy == OSExchangeData::CONVERT_FILENAMES) { |
235 *url = test_url; | 237 *url = test_url; |
236 *title = base::string16(); | 238 *title = base::string16(); |
237 return true; | 239 return true; |
238 } | 240 } |
239 } | 241 } |
240 } | 242 } |
241 } | 243 } |
242 | 244 |
243 return false; | 245 return false; |
244 } | 246 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 458 |
457 /////////////////////////////////////////////////////////////////////////////// | 459 /////////////////////////////////////////////////////////////////////////////// |
458 // OSExchangeData, public: | 460 // OSExchangeData, public: |
459 | 461 |
460 // static | 462 // static |
461 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 463 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
462 return new OSExchangeDataProviderAuraX11(); | 464 return new OSExchangeDataProviderAuraX11(); |
463 } | 465 } |
464 | 466 |
465 } // namespace ui | 467 } // namespace ui |
OLD | NEW |