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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c3ff464aec9d4ec253f5041a946203a451933b3 |
--- /dev/null |
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2015 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_H_ |
+#define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ |
+ |
+#include "base/mac/scoped_nsobject.h" |
+#include "components/open_from_clipboard/clipboard_recent_content.h" |
+#include "url/gurl.h" |
+ |
+@class NSDate; |
+@class PasteboardNotificationListenerBridge; |
+ |
+template <typename T> |
+struct DefaultSingletonTraits; |
+ |
+// IOS implementation of ClipboardRecentContent |
+class ClipboardRecentContentIOS : public ClipboardRecentContent { |
+ public: |
+ static ClipboardRecentContentIOS* GetInstance(); |
+ // Notifies that the content of the pasteboard may have changed. |
+ void PasteboardChanged(); |
+ |
+ // ClipboardRecentContent implementation. |
+ bool GetRecentURLFromClipboard(GURL* url) const override; |
+ |
+ private: |
+ friend struct DefaultSingletonTraits<ClipboardRecentContentIOS>; |
+ |
+ ClipboardRecentContentIOS(); |
+ ~ClipboardRecentContentIOS() override; |
+ // Loads information from the user defaults about the latest clipboard entry. |
+ void LoadFromUserDefaults(); |
+ // Saves information to the user defaults about the latest clipboard entry. |
+ void SaveToUserDefaults(); |
+ // Returns the URL contained in the clipboard (if any). |
+ GURL URLFromPasteboard(); |
+ |
+ // The pasteboard's change count. Increases everytime the pasteboard changes. |
+ NSInteger lastPasteboardChangeCount_; |
+ // Estimation of the date when the pasteboard changed. |
+ base::scoped_nsobject<NSDate> lastPasteboardChangeDate_; |
+ // Cache of the GURL contained in the pasteboard (if any). |
+ GURL urlFromPasteboardCache_; |
+ // Bridge to receive notification when the pasteboard changes. |
+ base::scoped_nsobject<PasteboardNotificationListenerBridge> |
+ notificationBridge_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContentIOS); |
+}; |
+ |
+#endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ |