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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_generic.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_generic.h
diff --git a/components/open_from_clipboard/clipboard_recent_content_generic.h b/components/open_from_clipboard/clipboard_recent_content_generic.h
new file mode 100644
index 0000000000000000000000000000000000000000..60024dc5b9c55639d7337e415d83ccb51a486b54
--- /dev/null
+++ b/components/open_from_clipboard/clipboard_recent_content_generic.h
@@ -0,0 +1,38 @@
+// Copyright 2017 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_GENERIC_H_
+#define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_GENERIC_H_
+
+#include "base/macros.h"
+#include "base/time/time.h"
+#include "components/open_from_clipboard/clipboard_recent_content.h"
+#include "url/gurl.h"
+
+// An implementation of ClipboardRecentContent that uses
+// ui/base/clipboard/clipboard.h
+// and hence works on all platforms for which Clipboard is implemented.
+// (This includes all platforms Chrome runs on except iOS.)
+// Note that on some platforms Clipboard may not implement the necessary
+// functions for this provider to function. In those cases, it will not do
+// anything.
+class ClipboardRecentContentGeneric : public ClipboardRecentContent {
+ public:
+ explicit ClipboardRecentContentGeneric();
+
+ // ClipboardRecentContent implementation.
+ bool GetRecentURLFromClipboard(GURL* url) override;
+ base::TimeDelta GetClipboardContentAge() const override;
+ void SuppressClipboardContent() override;
+
+ private:
+ // When told to suppress clipboard content, store the time of the last
+ // modified clipboard and suppress suggestions that correspond to that time.
+ // Set to base::Time() if not suppressing clipboard content.
+ base::Time last_modified_time_to_suppress_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContentGeneric);
+};
+
+#endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_GENERIC_H_

Powered by Google App Engine
This is Rietveld 408576698