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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios.mm

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_ios.mm
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios.mm b/components/open_from_clipboard/clipboard_recent_content_ios.mm
index 0ef8e97124dfac6e7a593f981902839c67878ac0..132daa30bd3d6b73d45bccb7e5816c43a142613b 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios.mm
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.mm
@@ -16,7 +16,6 @@
#include "base/strings/sys_string_conversions.h"
#include "base/sys_info.h"
#include "url/gurl.h"
-#include "url/url_constants.h"
// Bridge that forwards UIApplicationDidBecomeActiveNotification notifications
// to its delegate.
@@ -83,14 +82,6 @@ NSString* kPasteboardChangeDateKey = @"PasteboardChangeDate";
// Key used to store the hash of the content of the pasteboard. Whenever the
// hash changed, the pasteboard content is considered to have changed.
NSString* kPasteboardEntryMD5Key = @"PasteboardEntryMD5";
-base::TimeDelta kMaximumAgeOfClipboard = base::TimeDelta::FromHours(3);
-// Schemes accepted by the ClipboardRecentContentIOS.
-const char* kAuthorizedSchemes[] = {
- url::kHttpScheme,
- url::kHttpsScheme,
- url::kDataScheme,
- url::kAboutScheme,
-};
// Compute a hash consisting of the first 4 bytes of the MD5 hash of |string|.
// This value is used to detect pasteboard content change. Keeping only 4 bytes
@@ -208,11 +199,8 @@ GURL ClipboardRecentContentIOS::URLFromPasteboard() {
const std::string clipboard = base::SysNSStringToUTF8(clipboard_string);
GURL gurl = GURL(clipboard);
if (gurl.is_valid()) {
- for (size_t i = 0; i < arraysize(kAuthorizedSchemes); ++i) {
- if (gurl.SchemeIs(kAuthorizedSchemes[i])) {
- return gurl;
- }
- }
+ if (IsAppropriateSuggestion(gurl))
+ return gurl;
if (!application_scheme_.empty() &&
gurl.SchemeIs(application_scheme_.c_str())) {
return gurl;

Powered by Google App Engine
This is Rietveld 408576698