Stack sampling profiler: add fire-and-forget interface
[chromium-blink-merge.git] / components / open_from_clipboard / clipboard_recent_content.h
blobca2cf742b115221ddc76c1d7b981ee13afa34956
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_H_
6 #define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "base/time/time.h"
13 class GURL;
15 // Helper class returning an URL if the content of the clipboard can be turned
16 // into an URL, and if it estimates that the content of the clipboard is not too
17 // old.
18 class ClipboardRecentContent {
19 public:
20 // Returns an instance of the ClipboardContent singleton.
21 static ClipboardRecentContent* GetInstance();
23 // Returns true if the clipboard contains a recent URL that has not been
24 // supressed, and copies it in |url|. Otherwise, returns false. |url| must not
25 // be null.
26 virtual bool GetRecentURLFromClipboard(GURL* url) const = 0;
28 // Returns how old the content of the clipboard is.
29 virtual base::TimeDelta GetClipboardContentAge() const = 0;
31 // Prevent GetRecentURLFromClipboard from returning anything until the
32 // clipboard's content changed.
33 virtual void SuppressClipboardContent() = 0;
35 // Sets which URL scheme this app can be opened with. Used by
36 // ClipboardRecentContent to determine whether or not the clipboard contains
37 // a relevant URL. |application_scheme| may be empty.
38 void set_application_scheme(const std::string& application_scheme) {
39 application_scheme_ = application_scheme;
42 protected:
43 ClipboardRecentContent() {}
44 virtual ~ClipboardRecentContent() {}
45 // Contains the URL scheme opening the app. May be empty.
46 std::string application_scheme_;
48 private:
49 DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContent);
52 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_H_