Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_ | |
| 6 #define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 | |
| 10 // A protocol implemented by delegates to handle clipboard changes. | |
| 11 @protocol ClipboardRecentContentDelegate<NSObject> | |
| 12 | |
| 13 - (void)onClipboardChanged; | |
| 14 | |
| 15 @end | |
| 16 | |
| 17 // Helper class returning a URL if the content of the clipboard can be turned | |
| 18 // into a URL, and if it estimates that the content of the clipboard is not too | |
| 19 // old. | |
| 20 @interface ClipboardRecentContentImplIOS : NSObject | |
| 21 | |
| 22 // |delegate| is used for metrics logging and can be nil. |authorizedSchemes| | |
| 23 // should contain all schemes considered valid. |groupUserDefaults| is the | |
| 24 // NSUserDefaults used to store information on pasteboard entry expiration. This | |
| 25 // information will be shared with other applications in the application group. | |
| 26 - (instancetype)initWithAuthorizedSchemes:(NSSet*)authorizedSchemes | |
|
marq (ping after 24h)
2017/04/05 07:58:10
Use lightweight generics -- NSSet<NSString*>*
lody
2017/04/06 11:27:22
Done.
| |
| 27 userDefaults:(NSUserDefaults*)groupUserDefaults | |
| 28 delegate:(id<ClipboardRecentContentDelegate>) | |
| 29 delegate | |
| 30 NS_DESIGNATED_INITIALIZER; | |
| 31 | |
| 32 - (instancetype)init NS_UNAVAILABLE; | |
| 33 | |
| 34 // Returns true if the clipboard contains a recent URL that has not been | |
|
marq (ping after 24h)
2017/04/05 07:58:10
This method doesn't return a boolean at all.
lody
2017/04/06 11:27:22
... sorry :( that's what I get for lazy copy pasti
| |
| 35 // supressed, and copies it in |url|. Otherwise, returns false. |url| must not | |
| 36 // be null. | |
| 37 - (NSURL*)getRecentURLFromClipboard; | |
|
marq (ping after 24h)
2017/04/05 07:58:10
Don't use 'get' to name ObjC methods unless they
lody
2017/04/06 11:27:21
Done
(also, that links gives a sorry, that page ca
marq (ping after 24h)
2017/04/06 14:40:56
It should be .html, not .htm :
https://developer.a
| |
| 38 | |
| 39 // Returns how old the content of the clipboard is. | |
| 40 - (NSTimeInterval)getClipboardContentAge; | |
| 41 | |
| 42 // Prevent GetRecentURLFromClipboard from returning anything until the | |
|
marq (ping after 24h)
2017/04/05 07:58:10
Prevents
lody
2017/04/06 11:27:21
Done.
| |
| 43 // clipboard's content changes. | |
| 44 - (void)suppressClipboardContent; | |
| 45 | |
| 46 // Methods below are exposed for testing purposes. | |
| 47 | |
| 48 // Estimation of the date when the pasteboard changed. | |
| 49 @property(nonatomic, strong) NSDate* lastPasteboardChangeDate; | |
| 50 | |
| 51 // Saves information to the user defaults about the latest pasteboard entry. | |
| 52 - (void)saveToUserDefaults; | |
| 53 | |
| 54 @end | |
| 55 | |
| 56 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_ | |
| OLD | NEW |