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/utf_string_conversions.h" | 8 #include "base/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 10 matching lines...) Expand all Loading... |
21 formats_ |= OSExchangeData::STRING; | 21 formats_ |= OSExchangeData::STRING; |
22 } | 22 } |
23 | 23 |
24 void OSExchangeDataProviderAura::SetURL(const GURL& url, | 24 void OSExchangeDataProviderAura::SetURL(const GURL& url, |
25 const string16& title) { | 25 const string16& title) { |
26 url_ = url; | 26 url_ = url; |
27 title_ = title; | 27 title_ = title; |
28 formats_ |= OSExchangeData::URL; | 28 formats_ |= OSExchangeData::URL; |
29 } | 29 } |
30 | 30 |
31 void OSExchangeDataProviderAura::SetFilename(const FilePath& path) { | 31 void OSExchangeDataProviderAura::SetFilename(const base::FilePath& path) { |
32 filenames_.clear(); | 32 filenames_.clear(); |
33 filenames_.push_back(OSExchangeData::FileInfo(path, FilePath())); | 33 filenames_.push_back(OSExchangeData::FileInfo(path, base::FilePath())); |
34 formats_ |= OSExchangeData::FILE_NAME; | 34 formats_ |= OSExchangeData::FILE_NAME; |
35 } | 35 } |
36 | 36 |
37 void OSExchangeDataProviderAura::SetFilenames( | 37 void OSExchangeDataProviderAura::SetFilenames( |
38 const std::vector<OSExchangeData::FileInfo>& filenames) { | 38 const std::vector<OSExchangeData::FileInfo>& filenames) { |
39 filenames_ = filenames; | 39 filenames_ = filenames; |
40 formats_ |= OSExchangeData::FILE_NAME; | 40 formats_ |= OSExchangeData::FILE_NAME; |
41 } | 41 } |
42 | 42 |
43 void OSExchangeDataProviderAura::SetPickledData( | 43 void OSExchangeDataProviderAura::SetPickledData( |
(...skipping 18 matching lines...) Expand all Loading... |
62 } | 62 } |
63 | 63 |
64 if (!url_.is_valid()) | 64 if (!url_.is_valid()) |
65 return false; | 65 return false; |
66 | 66 |
67 *url = url_; | 67 *url = url_; |
68 *title = title_; | 68 *title = title_; |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 bool OSExchangeDataProviderAura::GetFilename(FilePath* path) const { | 72 bool OSExchangeDataProviderAura::GetFilename(base::FilePath* path) const { |
73 if ((formats_ & OSExchangeData::FILE_NAME) == 0) | 73 if ((formats_ & OSExchangeData::FILE_NAME) == 0) |
74 return false; | 74 return false; |
75 DCHECK(!filenames_.empty()); | 75 DCHECK(!filenames_.empty()); |
76 *path = filenames_[0].path; | 76 *path = filenames_[0].path; |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 bool OSExchangeDataProviderAura::GetFilenames( | 80 bool OSExchangeDataProviderAura::GetFilenames( |
81 std::vector<OSExchangeData::FileInfo>* filenames) const { | 81 std::vector<OSExchangeData::FileInfo>* filenames) const { |
82 if ((formats_ & OSExchangeData::FILE_NAME) == 0) | 82 if ((formats_ & OSExchangeData::FILE_NAME) == 0) |
(...skipping 29 matching lines...) Expand all Loading... |
112 return (formats_ & OSExchangeData::FILE_NAME) != 0; | 112 return (formats_ & OSExchangeData::FILE_NAME) != 0; |
113 } | 113 } |
114 | 114 |
115 bool OSExchangeDataProviderAura::HasCustomFormat( | 115 bool OSExchangeDataProviderAura::HasCustomFormat( |
116 OSExchangeData::CustomFormat format) const { | 116 OSExchangeData::CustomFormat format) const { |
117 return pickle_data_.find(format) != pickle_data_.end(); | 117 return pickle_data_.find(format) != pickle_data_.end(); |
118 } | 118 } |
119 | 119 |
120 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
121 void OSExchangeDataProviderAura::SetFileContents( | 121 void OSExchangeDataProviderAura::SetFileContents( |
122 const FilePath& filename, | 122 const base::FilePath& filename, |
123 const std::string& file_contents) { | 123 const std::string& file_contents) { |
124 NOTIMPLEMENTED(); | 124 NOTIMPLEMENTED(); |
125 } | 125 } |
126 | 126 |
127 bool OSExchangeDataProviderAura::GetFileContents( | 127 bool OSExchangeDataProviderAura::GetFileContents( |
128 FilePath* filename, | 128 base::FilePath* filename, |
129 std::string* file_contents) const { | 129 std::string* file_contents) const { |
130 NOTIMPLEMENTED(); | 130 NOTIMPLEMENTED(); |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 bool OSExchangeDataProviderAura::HasFileContents() const { | 134 bool OSExchangeDataProviderAura::HasFileContents() const { |
135 NOTIMPLEMENTED(); | 135 NOTIMPLEMENTED(); |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 OSExchangeData::CustomFormat | 202 OSExchangeData::CustomFormat |
203 OSExchangeData::RegisterCustomFormat(const std::string& type) { | 203 OSExchangeData::RegisterCustomFormat(const std::string& type) { |
204 // On Aura you probably want to just use the Clipboard::Get*FormatType APIs | 204 // On Aura you probably want to just use the Clipboard::Get*FormatType APIs |
205 // instead. But we can also dynamically generate new CustomFormat objects | 205 // instead. But we can also dynamically generate new CustomFormat objects |
206 // here too if really necessary. | 206 // here too if really necessary. |
207 return Clipboard::FormatType::Deserialize(type); | 207 return Clipboard::FormatType::Deserialize(type); |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 } // namespace ui | 211 } // namespace ui |
OLD | NEW |