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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios.h

Issue 1274713003: Refactor ClipboardRecentContent singleton creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment by jif Created 5 years, 4 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 e2050b6dac13d88692395f175a9a676855da0c49..5eba85a776ca9727af7499f954db03e2371f80f0 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios.h
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.h
@@ -12,45 +12,48 @@
@class NSDate;
@class PasteboardNotificationListenerBridge;
-namespace test {
-class ClipboardRecentContentIOSTestHelper;
-} // namespace test
-
-template <typename T>
-struct DefaultSingletonTraits;
+class ClipboardRecentContentIOSTest;
// IOS implementation of ClipboardRecentContent
class ClipboardRecentContentIOS : public ClipboardRecentContent {
public:
- static ClipboardRecentContentIOS* GetInstance();
+ // |application_scheme| is the URL scheme that can be used to open the
+ // current application, may be empty if no such scheme exists. Used to
+ // determine whether or not the clipboard contains a relevant URL.
+ explicit ClipboardRecentContentIOS(const std::string& application_scheme);
+ ~ClipboardRecentContentIOS() override;
+
// Notifies that the content of the pasteboard may have changed.
void PasteboardChanged();
+ // ClipboardRecentContent implementation.
bool GetRecentURLFromClipboard(GURL* url) const override;
-
base::TimeDelta GetClipboardContentAge() const override;
-
void SuppressClipboardContent() override;
- protected:
- // Protected for testing.
- ClipboardRecentContentIOS();
- ~ClipboardRecentContentIOS() override;
- // |uptime| is how long ago the device has started.
- ClipboardRecentContentIOS(base::TimeDelta uptime);
-
private:
- friend struct DefaultSingletonTraits<ClipboardRecentContentIOS>;
- friend class test::ClipboardRecentContentIOSTestHelper;
+ friend class ClipboardRecentContentIOSTest;
+
+ // Helper constructor for testing. |uptime| is how long ago the device has
+ // started, while |application_scheme| has the same meaning as the public
+ // constructor.
+ ClipboardRecentContentIOS(const std::string& application_scheme,
+ base::TimeDelta uptime);
+
// Initializes the object. |uptime| is how long ago the device has started.
void Init(base::TimeDelta uptime);
+
// Loads information from the user defaults about the latest pasteboard entry.
void LoadFromUserDefaults();
+
// 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 lastPasteboardChangeCount_;
// Estimation of the date when the pasteboard changed.

Powered by Google App Engine
This is Rietveld 408576698