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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios.h

Issue 2782823003: Rewrite implementation of ClipboardRecentContent in Objective C. (Closed)
Patch Set: nits 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 side-by-side diff with in-line comments
Download patch
Index: components/open_from_clipboard/clipboard_recent_content_ios.h
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios.h b/components/open_from_clipboard/clipboard_recent_content_ios.h
index d4b7d7ec831d06bd80e46dea4e7c04f23f0e2080..d5810c2676495d1800539e4babb03f5327b4435e 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios.h
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.h
@@ -11,11 +11,10 @@
#include "components/open_from_clipboard/clipboard_recent_content.h"
#include "url/gurl.h"
+@class NSArray;
@class NSDate;
@class NSUserDefaults;
-@class ApplicationDidBecomeActiveNotificationListenerBridge;
-
-class ClipboardRecentContentIOSTest;
+@class ClipboardRecentContentImplIOS;
// IOS implementation of ClipboardRecentContent
jif 2017/04/06 15:56:53 Can you add // IOS implementation of ClipboardRec
lody 2017/04/06 16:34:24 Done.
class ClipboardRecentContentIOS : public ClipboardRecentContent {
@@ -26,53 +25,22 @@ class ClipboardRecentContentIOS : public ClipboardRecentContent {
// |group_user_defaults| is the NSUserDefaults used to store information on
// pasteboard entry expiration. This information will be shared with other
// application in the application group.
- explicit ClipboardRecentContentIOS(const std::string& application_scheme,
- NSUserDefaults* group_user_defaults);
- ~ClipboardRecentContentIOS() override;
+ ClipboardRecentContentIOS(const std::string& application_scheme,
+ NSUserDefaults* group_user_defaults);
- // If the content of the pasteboard has changed, updates the change count,
- // change date, and md5 of the latest pasteboard entry if necessary.
- void UpdateIfNeeded();
+ // Constructor that directly takes an |implementation|. For use in tests.
+ ClipboardRecentContentIOS(ClipboardRecentContentImplIOS* implementation);
- // Returns whether the pasteboard changed since the last time a pasteboard
- // change was detected.
- bool HasPasteboardChanged() const;
-
- // Loads information from the user defaults about the latest pasteboard entry.
- void LoadFromUserDefaults();
+ ~ClipboardRecentContentIOS() override;
// ClipboardRecentContent implementation.
bool GetRecentURLFromClipboard(GURL* url) override;
base::TimeDelta GetClipboardContentAge() const override;
void SuppressClipboardContent() override;
- protected:
- // Returns the uptime. Override in tests to return custom value.
- virtual base::TimeDelta Uptime() const;
-
private:
- friend class ClipboardRecentContentIOSTest;
-
- // Saves information to the user defaults about the latest pasteboard entry.
- void SaveToUserDefaults();
-
- // Returns the URL contained in the clipboard (if any).
- GURL URLFromPasteboard();
-
- // Contains the URL scheme opening the app. May be empty.
- std::string application_scheme_;
- // The pasteboard's change count. Increases everytime the pasteboard changes.
- NSInteger last_pasteboard_change_count_;
- // Estimation of the date when the pasteboard changed.
- base::scoped_nsobject<NSDate> last_pasteboard_change_date_;
- // MD5 hash of the last registered pasteboard entry.
- base::scoped_nsobject<NSData> last_pasteboard_entry_md5_;
- // Bridge to receive notifications when the application becomes active.
- base::scoped_nsobject<ApplicationDidBecomeActiveNotificationListenerBridge>
- notification_bridge_;
- // The user defaults from the app group used to optimize the pasteboard change
- // detection.
- base::scoped_nsobject<NSUserDefaults> shared_user_defaults_;
+ // The implementation instance.
+ base::scoped_nsobject<ClipboardRecentContentImplIOS> implementation_;
DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContentIOS);
};

Powered by Google App Engine
This is Rietveld 408576698