| Index: components/open_from_clipboard/clipboard_recent_content.cc
|
| diff --git a/components/open_from_clipboard/clipboard_recent_content.cc b/components/open_from_clipboard/clipboard_recent_content.cc
|
| index 56312ec2ae029a7a5a3b99ede5d4e87b234fc38e..2616984bf4b4595e961d4ae5052e2cbe46dca5bb 100644
|
| --- a/components/open_from_clipboard/clipboard_recent_content.cc
|
| +++ b/components/open_from_clipboard/clipboard_recent_content.cc
|
| @@ -4,9 +4,25 @@
|
|
|
| #include "components/open_from_clipboard/clipboard_recent_content.h"
|
|
|
| +#include "url/url_constants.h"
|
| +
|
| namespace {
|
| ClipboardRecentContent* g_clipboard_recent_content = nullptr;
|
| -}
|
| +
|
| +// Schemes appropriate for suggestion by ClipboardRecentContent.
|
| +const char* kAuthorizedSchemes[] = {
|
| + url::kAboutScheme, url::kDataScheme, url::kHttpScheme, url::kHttpsScheme,
|
| + // TODO(mpearson): add support for chrome:// URLs. Right now the scheme
|
| + // for that lives in content and is accessible via
|
| + // GetEmbedderRepresentationOfAboutScheme() or content::kChromeUIScheme
|
| + // TODO(mpearson): when adding desktop support, add kFileScheme, kFtpScheme,
|
| + // and kGopherScheme.
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +constexpr base::TimeDelta ClipboardRecentContent::kMaximumAgeOfClipboard =
|
| + base::TimeDelta::FromHours(3);
|
|
|
| ClipboardRecentContent::ClipboardRecentContent() {}
|
|
|
| @@ -21,3 +37,15 @@ ClipboardRecentContent* ClipboardRecentContent::GetInstance() {
|
| void ClipboardRecentContent::SetInstance(ClipboardRecentContent* instance) {
|
| g_clipboard_recent_content = instance;
|
| }
|
| +
|
| +// static
|
| +bool ClipboardRecentContent::IsAppropriateSuggestion(const GURL& url) {
|
| + // Check to make sure it's a scheme we're willing to suggest.
|
| + for (const auto* authorized_scheme : kAuthorizedSchemes) {
|
| + if (url.SchemeIs(authorized_scheme))
|
| + return true;
|
| + }
|
| +
|
| + // Not a scheme we're allowed to return.
|
| + return false;
|
| +}
|
|
|