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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios.h

Issue 930323003: Upstream iOS' Open from Clipboard component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated actions.xml Created 5 years, 10 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
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_

Powered by Google App Engine
This is Rietveld 408576698