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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios_impl.h

Issue 2782823003: Rewrite implementation of ClipboardRecentContent in Objective C. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/open_from_clipboard/clipboard_recent_content_ios_impl.h
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios_impl.h b/components/open_from_clipboard/clipboard_recent_content_ios_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..df44827e22451707af0ac0c02a500ef6f24e3eb3
--- /dev/null
+++ b/components/open_from_clipboard/clipboard_recent_content_ios_impl.h
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_IMPL_H_
+#define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_IMPL_H_
+
+#import <Foundation/Foundation.h>
+
+#include "base/macros.h"
+
+// A protocol implemented by delegates to handle logging metrics.
+@protocol ClipboardRecentContentMetricsDelegate<NSObject>
+
+- (void)onClipboardChanged;
+
+@end
+
+// Objective C iOS implementation of ClipboardRecentContent.
+@interface ClipboardRecentContentIOSImpl : NSObject
+
+// |delegate| is used for metrics logging and can be nil. |authorizedSchemes|
+// should contain all schemes considered valid. |groupUserDefaults| is the
+// NSUserDefaults used to store information on pasteboard entry expiration. This
+// information will be shared with other applications in the application group.
+- (instancetype)initWithDelegate:
+ (id<ClipboardRecentContentMetricsDelegate>)delegate
+ authorizedSchemes:(NSArray*)authorizedSchemes
+ userDefaults:(NSUserDefaults*)groupUserDefaults
+ NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+// ClipboardRecentContent implementation.
+- (NSURL*)getRecentURLFromClipboard;
+- (NSTimeInterval)getClipboardContentAge;
+- (void)suppressClipboardContent;
+
+// Methods below are exposed for testing purposes.
jif 2017/03/29 14:17:56 I don't they they are used by tests.
lody 2017/03/30 13:36:34 Line 83 in clipboard_recent_content_ios_unittest:
jif 2017/03/31 13:14:47 What I'm trying to say is that those 2 obj-c metho
lody 2017/03/31 13:28:19 As clarified offline, they are in fact only needed
+
+// Estimation of the date when the pasteboard changed.
+@property(nonatomic, strong) NSDate* lastPasteboardChangeDate;
+
+// Saves information to the user defaults about the latest pasteboard entry.
+- (void)saveToUserDefaults;
+// Returns the uptime. Override in tests to return custom value.
jif 2017/03/29 14:17:55 Not overridden by tests. And are unittests passing
lody 2017/03/30 13:36:34 You were right. Changed so uptime is actually over
jif 2017/03/31 13:14:47 Acknowledged.
+- (NSTimeInterval)uptime;
+
+@end
+
+#endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698