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