Fix crash in ResourceLoader if the resources were retrieved before BlockUntilLoaded...
[chromium-blink-merge.git] / components / open_from_clipboard / clipboard_recent_content.h
blob31c274c8fdcc47d30e0b13c2bb78f9e88a0e5b3b
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"
12 class GURL;
14 // Helper class returning an URL if the content of the clipboard can be turned
15 // into an URL, and if it estimates that the content of the clipboard is not too
16 // old.
17 class ClipboardRecentContent {
18 public:
19 // Returns an instance of the ClipboardContent singleton.
20 static ClipboardRecentContent* GetInstance();
22 // Returns true if the clipboard contains a recent URL, and copies it in
23 // |url|. Otherwise, returns false. |url| must not be null.
24 virtual bool GetRecentURLFromClipboard(GURL* url) const = 0;
26 // Sets which URL scheme this app can be opened with. Used by
27 // ClipboardRecentContent to determine whether or not the clipboard contains
28 // a relevant URL. |application_scheme| may be empty.
29 void set_application_scheme(const std::string& application_scheme) {
30 application_scheme_ = application_scheme;
33 protected:
34 ClipboardRecentContent() {}
35 virtual ~ClipboardRecentContent() {}
36 // Contains the URL scheme opening the app. May be empty.
37 std::string application_scheme_;
39 private:
40 DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContent);
43 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_H_