| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/views/mus/os_exchange_data_provider_mus.h" | 5 #include "ui/views/mus/os_exchange_data_provider_mus.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 #include <string> |
| 9 #include <utility> |
| 10 #include <vector> |
| 11 |
| 7 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 8 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 11 #include "mojo/common/common_type_converters.h" | 16 #include "mojo/common/common_type_converters.h" |
| 12 #include "net/base/filename_util.h" | 17 #include "net/base/filename_util.h" |
| 13 #include "services/ui/public/interfaces/clipboard.mojom.h" | 18 #include "services/ui/public/interfaces/clipboard.mojom.h" |
| 14 #include "ui/base/dragdrop/file_info.h" | 19 #include "ui/base/dragdrop/file_info.h" |
| 15 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 16 | 21 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 45 std::vector<uint8_t>* bytes) { | 50 std::vector<uint8_t>* bytes) { |
| 46 const unsigned char* front = | 51 const unsigned char* front = |
| 47 reinterpret_cast<const uint8_t*>(str.data()); | 52 reinterpret_cast<const uint8_t*>(str.data()); |
| 48 bytes->insert(bytes->end(), front, front + (str.size() * 2)); | 53 bytes->insert(bytes->end(), front, front + (str.size() * 2)); |
| 49 } | 54 } |
| 50 | 55 |
| 51 } // namespace | 56 } // namespace |
| 52 | 57 |
| 53 OSExchangeDataProviderMus::OSExchangeDataProviderMus() {} | 58 OSExchangeDataProviderMus::OSExchangeDataProviderMus() {} |
| 54 | 59 |
| 60 OSExchangeDataProviderMus::OSExchangeDataProviderMus(Data data) |
| 61 : mime_data_(std::move(data)) {} |
| 62 |
| 55 OSExchangeDataProviderMus::~OSExchangeDataProviderMus() {} | 63 OSExchangeDataProviderMus::~OSExchangeDataProviderMus() {} |
| 56 | 64 |
| 57 OSExchangeDataProviderMus::Data OSExchangeDataProviderMus::GetData() const { | 65 OSExchangeDataProviderMus::Data OSExchangeDataProviderMus::GetData() const { |
| 58 return mime_data_; | 66 return mime_data_; |
| 59 } | 67 } |
| 60 | 68 |
| 61 std::unique_ptr<ui::OSExchangeData::Provider> | 69 std::unique_ptr<ui::OSExchangeData::Provider> |
| 62 OSExchangeDataProviderMus::Clone() const { | 70 OSExchangeDataProviderMus::Clone() const { |
| 63 std::unique_ptr<OSExchangeDataProviderMus> r = | 71 std::unique_ptr<OSExchangeDataProviderMus> r = |
| 64 base::MakeUnique<OSExchangeDataProviderMus>(); | 72 base::MakeUnique<OSExchangeDataProviderMus>(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 const ui::Clipboard::FormatType& format) const { | 252 const ui::Clipboard::FormatType& format) const { |
| 245 return base::ContainsKey(mime_data_, format.Serialize()); | 253 return base::ContainsKey(mime_data_, format.Serialize()); |
| 246 } | 254 } |
| 247 | 255 |
| 248 // These methods were added in an ad-hoc way to different operating | 256 // These methods were added in an ad-hoc way to different operating |
| 249 // systems. We need to support them until they get cleaned up. | 257 // systems. We need to support them until they get cleaned up. |
| 250 #if (!defined(OS_CHROMEOS) && defined(USE_X11)) || defined(OS_WIN) | 258 #if (!defined(OS_CHROMEOS) && defined(USE_X11)) || defined(OS_WIN) |
| 251 void OSExchangeDataProviderMus::SetFileContents( | 259 void OSExchangeDataProviderMus::SetFileContents( |
| 252 const base::FilePath& filename, | 260 const base::FilePath& filename, |
| 253 const std::string& file_contents) { | 261 const std::string& file_contents) { |
| 254 | |
| 255 } | 262 } |
| 256 #endif | 263 #endif |
| 257 | 264 |
| 258 #if defined(OS_WIN) | 265 #if defined(OS_WIN) |
| 259 bool OSExchangeDataProviderMus::GetFileContents( | 266 bool OSExchangeDataProviderMus::GetFileContents( |
| 260 base::FilePath* filename, | 267 base::FilePath* filename, |
| 261 std::string* file_contents) const { | 268 std::string* file_contents) const { |
| 262 return false; | 269 return false; |
| 263 } | 270 } |
| 264 | 271 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 GURL test_url(str); | 363 GURL test_url(str); |
| 357 if (!test_url.is_valid()) | 364 if (!test_url.is_valid()) |
| 358 return false; | 365 return false; |
| 359 | 366 |
| 360 if (url) | 367 if (url) |
| 361 *url = test_url; | 368 *url = test_url; |
| 362 return true; | 369 return true; |
| 363 } | 370 } |
| 364 | 371 |
| 365 } // namespace views | 372 } // namespace views |
| OLD | NEW |