| Index: components/open_from_clipboard/clipboard_recent_content_generic.cc
|
| diff --git a/components/open_from_clipboard/clipboard_recent_content_generic.cc b/components/open_from_clipboard/clipboard_recent_content_generic.cc
|
| index 15ffa42eb9837128e29cdc6d8aef60972cf7f6e8..70b3691661d690b5f9fc04f02bcd7b1e1cb5a8b3 100644
|
| --- a/components/open_from_clipboard/clipboard_recent_content_generic.cc
|
| +++ b/components/open_from_clipboard/clipboard_recent_content_generic.cc
|
| @@ -7,6 +7,19 @@
|
| #include "base/strings/string_util.h"
|
| #include "ui/base/clipboard/clipboard.h"
|
|
|
| +namespace {
|
| +// 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
|
| +
|
| ClipboardRecentContentGeneric::ClipboardRecentContentGeneric() {}
|
|
|
| bool ClipboardRecentContentGeneric::GetRecentURLFromClipboard(GURL* url) {
|
| @@ -63,3 +76,15 @@ void ClipboardRecentContentGeneric::SuppressClipboardContent() {
|
| // not recent.
|
| ui::Clipboard::GetForCurrentThread()->ClearLastModifiedTime();
|
| }
|
| +
|
| +// static
|
| +bool ClipboardRecentContentGeneric::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;
|
| +}
|
|
|