| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_COCOA_FIND_PASTEBOARD_H_ |
| 6 #define CHROME_BROWSER_COCOA_FIND_PASTEBOARD_H_ |
| 7 |
| 8 #include "base/string16.h" |
| 9 |
| 10 #ifdef __OBJC__ |
| 11 |
| 12 #import <Cocoa/Cocoa.h> |
| 13 |
| 14 #include "base/scoped_nsobject.h" |
| 15 |
| 16 extern NSString* kFindPasteboardChangedNotification; |
| 17 |
| 18 // Manages the find pasteboard. Use this to copy text to the find pasteboard, |
| 19 // to get the text currently on the find pasteboard, and to receive |
| 20 // notifications when the text on the find pasteboard has changed. You should |
| 21 // always use this class instead of accessing |
| 22 // [NSPasteboard pasteboardWithName:NSFindPboard] directly. |
| 23 // |
| 24 // This is not thread-safe and must be used on the main thread. |
| 25 // |
| 26 // This is supposed to be a singleton. |
| 27 @interface FindPasteboard : NSObject { |
| 28 @private |
| 29 scoped_nsobject<NSString> findText_; |
| 30 } |
| 31 |
| 32 // Returns the singleton instance of this class. |
| 33 + (FindPasteboard*)sharedInstance; |
| 34 |
| 35 // Returns the current find text. This is never nil; if there is no text on the |
| 36 // find pasteboard, this returns an empty string. |
| 37 - (NSString*)findText; |
| 38 |
| 39 // Sets the current find text to |newText| and sends a |
| 40 // |kFindPasteboardChangedNotification| to the default notification center if |
| 41 // it the new text different from the current text. |newText| must not be nil. |
| 42 - (void)setFindText:(NSString*)newText; |
| 43 @end |
| 44 |
| 45 @interface FindPasteboard (TestingAPI) |
| 46 - (void)loadTextFromPasteboard:(NSNotification*)notification; |
| 47 |
| 48 // This methods is meant to be overridden in tests. |
| 49 - (NSPasteboard*)findPboard; |
| 50 @end |
| 51 |
| 52 #endif // __OBJC__ |
| 53 |
| 54 // Also provide a c++ interface |
| 55 string16 GetFindPboardText(); |
| 56 |
| 57 #endif // CHROME_BROWSER_COCOA_FIND_PASTEBOARD_H_ |
| OLD | NEW |