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

Side by Side Diff: components/open_from_clipboard/clipboard_recent_content_impl_ios.h

Issue 2817003003: Get maximum age of clipboard from clipboard_recent_contents.cc in iOS impl (Closed)
Patch Set: fix generic + rebase Created 3 years, 8 months 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 #ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_ 5 #ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_
6 #define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_ 6 #define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 // A protocol implemented by delegates to handle clipboard changes. 10 // A protocol implemented by delegates to handle clipboard changes.
11 @protocol ClipboardRecentContentDelegate<NSObject> 11 @protocol ClipboardRecentContentDelegate<NSObject>
12 12
13 - (void)onClipboardChanged; 13 - (void)onClipboardChanged;
14 14
15 @end 15 @end
16 16
17 // Helper class returning a URL if the content of the clipboard can be turned 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 18 // into a URL, and if it estimates that the content of the clipboard is not too
19 // old. 19 // old.
20 @interface ClipboardRecentContentImplIOS : NSObject 20 @interface ClipboardRecentContentImplIOS : NSObject
21 21
22 // |delegate| is used for metrics logging and can be nil. |authorizedSchemes| 22 // |delegate| is used for metrics logging and can be nil. |authorizedSchemes|
23 // should contain all schemes considered valid. |groupUserDefaults| is the 23 // should contain all schemes considered valid. |groupUserDefaults| is the
24 // NSUserDefaults used to store information on pasteboard entry expiration. This 24 // NSUserDefaults used to store information on pasteboard entry expiration. This
25 // information will be shared with other applications in the application group. 25 // information will be shared with other applications in the application group.
26 - (instancetype)initWithAuthorizedSchemes:(NSSet<NSString*>*)authorizedSchemes 26 - (instancetype)initWithMaxAge:(NSTimeInterval)maxAge
27 userDefaults:(NSUserDefaults*)groupUserDefaults 27 authorizedSchemes:(NSSet<NSString*>*)authorizedSchemes
28 delegate:(id<ClipboardRecentContentDelegate>) 28 userDefaults:(NSUserDefaults*)groupUserDefaults
29 delegate 29 delegate:(id<ClipboardRecentContentDelegate>)delegate
30 NS_DESIGNATED_INITIALIZER; 30 NS_DESIGNATED_INITIALIZER;
31 31
32 - (instancetype)init NS_UNAVAILABLE; 32 - (instancetype)init NS_UNAVAILABLE;
33 33
34 // Returns the copied URL if the clipboard contains a recent URL that has not 34 // Returns the copied URL if the clipboard contains a recent URL that has not
35 // been supressed. Otherwise, returns nil. 35 // been supressed. Otherwise, returns nil.
36 - (NSURL*)recentURLFromClipboard; 36 - (NSURL*)recentURLFromClipboard;
37 37
38 // Returns how old the content of the clipboard is. 38 // Returns how old the content of the clipboard is.
39 - (NSTimeInterval)clipboardContentAge; 39 - (NSTimeInterval)clipboardContentAge;
40 40
41 // Prevents GetRecentURLFromClipboard from returning anything until the 41 // Prevents GetRecentURLFromClipboard from returning anything until the
42 // clipboard's content changes. 42 // clipboard's content changes.
43 - (void)suppressClipboardContent; 43 - (void)suppressClipboardContent;
44 44
45 // Methods below are exposed for testing purposes. 45 // Methods below are exposed for testing purposes.
46 46
47 // Estimation of the date when the pasteboard changed. 47 // Estimation of the date when the pasteboard changed.
48 @property(nonatomic, strong) NSDate* lastPasteboardChangeDate; 48 @property(nonatomic, strong) NSDate* lastPasteboardChangeDate;
49 49
50 // Saves information to the user defaults about the latest pasteboard entry. 50 // Saves information to the user defaults about the latest pasteboard entry.
51 - (void)saveToUserDefaults; 51 - (void)saveToUserDefaults;
52 52
53 @end 53 @end
54 54
55 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_ 55 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IMPL_IOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698