| 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_aura.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
| 10 #include "ui/base/clipboard/clipboard.h" | 10 #include "ui/base/clipboard/clipboard.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 void OSExchangeDataProviderAura::SetFilenames( | 69 void OSExchangeDataProviderAura::SetFilenames( |
| 70 const std::vector<FileInfo>& filenames) { | 70 const std::vector<FileInfo>& filenames) { |
| 71 filenames_ = filenames; | 71 filenames_ = filenames; |
| 72 formats_ |= OSExchangeData::FILE_NAME; | 72 formats_ |= OSExchangeData::FILE_NAME; |
| 73 } | 73 } |
| 74 | 74 |
| 75 void OSExchangeDataProviderAura::SetPickledData( | 75 void OSExchangeDataProviderAura::SetPickledData( |
| 76 const OSExchangeData::CustomFormat& format, | 76 const OSExchangeData::CustomFormat& format, |
| 77 const Pickle& data) { | 77 const base::Pickle& data) { |
| 78 pickle_data_[format] = data; | 78 pickle_data_[format] = data; |
| 79 formats_ |= OSExchangeData::PICKLED_DATA; | 79 formats_ |= OSExchangeData::PICKLED_DATA; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool OSExchangeDataProviderAura::GetString(base::string16* data) const { | 82 bool OSExchangeDataProviderAura::GetString(base::string16* data) const { |
| 83 if ((formats_ & OSExchangeData::STRING) == 0) | 83 if ((formats_ & OSExchangeData::STRING) == 0) |
| 84 return false; | 84 return false; |
| 85 *data = string_; | 85 *data = string_; |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 115 bool OSExchangeDataProviderAura::GetFilenames( | 115 bool OSExchangeDataProviderAura::GetFilenames( |
| 116 std::vector<FileInfo>* filenames) const { | 116 std::vector<FileInfo>* filenames) const { |
| 117 if ((formats_ & OSExchangeData::FILE_NAME) == 0) | 117 if ((formats_ & OSExchangeData::FILE_NAME) == 0) |
| 118 return false; | 118 return false; |
| 119 *filenames = filenames_; | 119 *filenames = filenames_; |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool OSExchangeDataProviderAura::GetPickledData( | 123 bool OSExchangeDataProviderAura::GetPickledData( |
| 124 const OSExchangeData::CustomFormat& format, | 124 const OSExchangeData::CustomFormat& format, |
| 125 Pickle* data) const { | 125 base::Pickle* data) const { |
| 126 PickleData::const_iterator i = pickle_data_.find(format); | 126 PickleData::const_iterator i = pickle_data_.find(format); |
| 127 if (i == pickle_data_.end()) | 127 if (i == pickle_data_.end()) |
| 128 return false; | 128 return false; |
| 129 | 129 |
| 130 *data = i->second; | 130 *data = i->second; |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool OSExchangeDataProviderAura::HasString() const { | 134 bool OSExchangeDataProviderAura::HasString() const { |
| 135 return (formats_ & OSExchangeData::STRING) != 0; | 135 return (formats_ & OSExchangeData::STRING) != 0; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 /////////////////////////////////////////////////////////////////////////////// | 206 /////////////////////////////////////////////////////////////////////////////// |
| 207 // OSExchangeData, public: | 207 // OSExchangeData, public: |
| 208 | 208 |
| 209 // static | 209 // static |
| 210 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 210 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
| 211 return new OSExchangeDataProviderAura(); | 211 return new OSExchangeDataProviderAura(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace ui | 214 } // namespace ui |
| OLD | NEW |