| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (data.IsValid()) { | 170 if (data.IsValid()) { |
| 171 std::string text = data.GetText(); | 171 std::string text = data.GetText(); |
| 172 *result = UTF8ToUTF16(text); | 172 *result = UTF8ToUTF16(text); |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 | 178 |
| 179 bool OSExchangeDataProviderAuraX11::GetURLAndTitle( | 179 bool OSExchangeDataProviderAuraX11::GetURLAndTitle( |
| 180 OSExchangeData::FilenameToURLPolicy policy, |
| 180 GURL* url, | 181 GURL* url, |
| 181 base::string16* title) const { | 182 base::string16* title) const { |
| 182 std::vector< ::Atom> url_atoms = ui::GetURLAtomsFrom(&atom_cache_); | 183 std::vector< ::Atom> url_atoms = ui::GetURLAtomsFrom(&atom_cache_); |
| 183 std::vector< ::Atom> requested_types; | 184 std::vector< ::Atom> requested_types; |
| 184 ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types); | 185 ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types); |
| 185 | 186 |
| 186 ui::SelectionData data(format_map_.GetFirstOf(requested_types)); | 187 ui::SelectionData data(format_map_.GetFirstOf(requested_types)); |
| 187 if (data.IsValid()) { | 188 if (data.IsValid()) { |
| 188 // TODO(erg): Technically, both of these forms can accept multiple URLs, | 189 // TODO(erg): Technically, both of these forms can accept multiple URLs, |
| 189 // but that doesn't match the assumptions of the rest of the system which | 190 // but that doesn't match the assumptions of the rest of the system which |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 374 |
| 374 /////////////////////////////////////////////////////////////////////////////// | 375 /////////////////////////////////////////////////////////////////////////////// |
| 375 // OSExchangeData, public: | 376 // OSExchangeData, public: |
| 376 | 377 |
| 377 // static | 378 // static |
| 378 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 379 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
| 379 return new OSExchangeDataProviderAuraX11(); | 380 return new OSExchangeDataProviderAuraX11(); |
| 380 } | 381 } |
| 381 | 382 |
| 382 } // namespace ui | 383 } // namespace ui |
| OLD | NEW |