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

Unified Diff: components/open_from_clipboard/clipboard_recent_content.h

Issue 2790993003: Add Generic Implementation of ClipboardRecentContent (Closed)
Patch Set: tested interactively; works. removed field trial force-enable code 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.h
diff --git a/components/open_from_clipboard/clipboard_recent_content.h b/components/open_from_clipboard/clipboard_recent_content.h
index 46e3449c3055a909c4527437c74a6a1650c7868b..e7d55e92e1d3811e1f45c38d8e4a299c68fd8301 100644
--- a/components/open_from_clipboard/clipboard_recent_content.h
+++ b/components/open_from_clipboard/clipboard_recent_content.h
@@ -9,8 +9,7 @@
#include "base/macros.h"
#include "base/time/time.h"
-
-class GURL;
+#include "url/gurl.h"
// Helper class returning an URL if the content of the clipboard can be turned
// into an URL, and if it estimates that the content of the clipboard is not too
@@ -28,9 +27,9 @@ class ClipboardRecentContent {
// Sets the global instance of ClipboardRecentContent singleton.
static void SetInstance(ClipboardRecentContent* instance);
- // Returns true if the clipboard contains a recent URL that has not been
- // supressed, and copies it in |url|. Otherwise, returns false. |url| must not
- // be null.
+ // Returns true if the clipboard contains a recent URL that is appropriate to
+ // be suggested and has not been supressed, and copies it in |url|.
+ // Otherwise, returns false. |url| must not be null.
virtual bool GetRecentURLFromClipboard(GURL* url) = 0;
// Returns how old the content of the clipboard is.
@@ -40,6 +39,14 @@ class ClipboardRecentContent {
// clipboard's content changed.
virtual void SuppressClipboardContent() = 0;
+ protected:
+ // GetRecentURLFromClipboard() should never return a URL from a clipboard
+ // older than this.
+ const base::TimeDelta kMaximumAgeOfClipboard = base::TimeDelta::FromHours(3);
+
+ // Returns true if the URL is appropriate to be suggested.
+ static bool IsAppropriateSuggestion(const GURL& url);
+
private:
DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContent);
};

Powered by Google App Engine
This is Rietveld 408576698