OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 // Safari only places RTF on the pasteboard, never HTML. We can convert RTF | 171 // Safari only places RTF on the pasteboard, never HTML. We can convert RTF |
172 // to HTML, so the presence of either indicates success when looking for HTML. | 172 // to HTML, so the presence of either indicates success when looking for HTML. |
173 if ([format_ns isEqualToString:NSHTMLPboardType]) { | 173 if ([format_ns isEqualToString:NSHTMLPboardType]) { |
174 return [types containsObject:NSHTMLPboardType] || | 174 return [types containsObject:NSHTMLPboardType] || |
175 [types containsObject:NSRTFPboardType]; | 175 [types containsObject:NSRTFPboardType]; |
176 } | 176 } |
177 return [types containsObject:format_ns]; | 177 return [types containsObject:format_ns]; |
178 } | 178 } |
179 | 179 |
| 180 void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer, |
| 181 std::vector<string16>* types, |
| 182 bool* contains_filenames) const { |
| 183 if (!types || !contains_filenames) { |
| 184 NOTREACHED(); |
| 185 return; |
| 186 } |
| 187 |
| 188 // TODO(dcheng): Implement me. |
| 189 types->clear(); |
| 190 *contains_filenames = false; |
| 191 } |
| 192 |
180 void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const { | 193 void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const { |
181 DCHECK_EQ(buffer, BUFFER_STANDARD); | 194 DCHECK_EQ(buffer, BUFFER_STANDARD); |
182 NSPasteboard* pb = GetPasteboard(); | 195 NSPasteboard* pb = GetPasteboard(); |
183 NSString* contents = [pb stringForType:NSStringPboardType]; | 196 NSString* contents = [pb stringForType:NSStringPboardType]; |
184 | 197 |
185 UTF8ToUTF16([contents UTF8String], | 198 UTF8ToUTF16([contents UTF8String], |
186 [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding], | 199 [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding], |
187 result); | 200 result); |
188 } | 201 } |
189 | 202 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 359 } |
347 | 360 |
348 // static | 361 // static |
349 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 362 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
350 static const std::string type = | 363 static const std::string type = |
351 base::SysNSStringToUTF8(kWebSmartPastePboardType); | 364 base::SysNSStringToUTF8(kWebSmartPastePboardType); |
352 return type; | 365 return type; |
353 } | 366 } |
354 | 367 |
355 } // namespace ui | 368 } // namespace ui |
OLD | NEW |