Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: ui/base/clipboard/clipboard_mac.mm

Issue 685043002: MacViews: Implement FormatType::operator< on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for dcheng Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/clipboard/clipboard.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/clipboard/clipboard_mac.h" 5 #include "ui/base/clipboard/clipboard_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 std::string Clipboard::FormatType::Serialize() const { 82 std::string Clipboard::FormatType::Serialize() const {
83 return base::SysNSStringToUTF8(data_); 83 return base::SysNSStringToUTF8(data_);
84 } 84 }
85 85
86 // static 86 // static
87 Clipboard::FormatType Clipboard::FormatType::Deserialize( 87 Clipboard::FormatType Clipboard::FormatType::Deserialize(
88 const std::string& serialization) { 88 const std::string& serialization) {
89 return FormatType(base::SysUTF8ToNSString(serialization)); 89 return FormatType(base::SysUTF8ToNSString(serialization));
90 } 90 }
91 91
92 #if defined(TOOLKIT_VIEWS)
93 bool Clipboard::FormatType::operator<(const FormatType& other) const {
94 return [data_ compare:other.data_] == NSOrderedAscending;
95 }
96 #endif
97
92 // Various predefined FormatTypes. 98 // Various predefined FormatTypes.
93 // static 99 // static
94 Clipboard::FormatType Clipboard::GetFormatType( 100 Clipboard::FormatType Clipboard::GetFormatType(
95 const std::string& format_string) { 101 const std::string& format_string) {
96 return FormatType::Deserialize(format_string); 102 return FormatType::Deserialize(format_string);
97 } 103 }
98 104
99 // static 105 // static
100 const Clipboard::FormatType& Clipboard::GetUrlFormatType() { 106 const Clipboard::FormatType& Clipboard::GetUrlFormatType() {
101 CR_DEFINE_STATIC_LOCAL(FormatType, type, (NSURLPboardType)); 107 CR_DEFINE_STATIC_LOCAL(FormatType, type, (NSURLPboardType));
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // Write an extra flavor that signifies WebKit was the last to modify the 450 // Write an extra flavor that signifies WebKit was the last to modify the
445 // pasteboard. This flavor has no data. 451 // pasteboard. This flavor has no data.
446 void ClipboardMac::WriteWebSmartPaste() { 452 void ClipboardMac::WriteWebSmartPaste() {
447 NSPasteboard* pb = GetPasteboard(); 453 NSPasteboard* pb = GetPasteboard();
448 NSString* format = GetWebKitSmartPasteFormatType().ToNSString(); 454 NSString* format = GetWebKitSmartPasteFormatType().ToNSString();
449 [pb addTypes:[NSArray arrayWithObject:format] owner:nil]; 455 [pb addTypes:[NSArray arrayWithObject:format] owner:nil];
450 [pb setData:nil forType:format]; 456 [pb setData:nil forType:format];
451 } 457 }
452 458
453 } // namespace ui 459 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698