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

Unified Diff: components/open_from_clipboard/clipboard_recent_content_ios.mm

Issue 1804143005: Reverts a temporary fix for UIPasteboard on iOS 9 beta 5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test Created 4 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
« no previous file with comments | « no previous file | components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0f483cfed5d24075788da39b3c72d4d4747dfbe4..36df14356285f439990a01b2142a7d7f7d09a14a 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios.mm
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.mm
@@ -148,9 +148,6 @@ void ClipboardRecentContentIOS::SuppressClipboardContent() {
}
void ClipboardRecentContentIOS::PasteboardChanged() {
- NSString* pasteboard_string = [[UIPasteboard generalPasteboard] string];
- if (!pasteboard_string)
- return;
url_from_pasteboard_cache_ = URLFromPasteboard();
if (!url_from_pasteboard_cache_.is_empty()) {
base::RecordAction(
@@ -158,6 +155,10 @@ void ClipboardRecentContentIOS::PasteboardChanged() {
}
last_pasteboard_change_date_.reset([[NSDate date] retain]);
last_pasteboard_change_count_ = [UIPasteboard generalPasteboard].changeCount;
+ NSString* pasteboard_string = [[UIPasteboard generalPasteboard] string];
+ if (!pasteboard_string) {
+ pasteboard_string = @"";
+ }
NSData* MD5 = WeakMD5FromNSString(pasteboard_string);
last_pasteboard_entry_md5_.reset([MD5 retain]);
SaveToUserDefaults();
@@ -180,13 +181,6 @@ ClipboardRecentContentIOS::ClipboardRecentContentIOS(
}
bool ClipboardRecentContentIOS::HasPasteboardChanged(base::TimeDelta uptime) {
- // If [[UIPasteboard generalPasteboard] string] is nil, the content of the
- // pasteboard cannot be accessed. This case should not be considered as a
- // pasteboard change.
- NSString* pasteboard_string = [[UIPasteboard generalPasteboard] string];
- if (!pasteboard_string)
- return NO;
-
// If |MD5Changed|, we know for sure there has been at least one pasteboard
// copy since last time it was checked.
// If the pasteboard content is still the same but the device was not
@@ -202,6 +196,10 @@ bool ClipboardRecentContentIOS::HasPasteboardChanged(base::TimeDelta uptime) {
if (not_rebooted)
return change_count_changed;
+ NSString* pasteboard_string = [[UIPasteboard generalPasteboard] string];
+ if (!pasteboard_string) {
+ pasteboard_string = @"";
+ }
NSData* md5 = WeakMD5FromNSString(pasteboard_string);
BOOL md5_changed = ![md5 isEqualToData:last_pasteboard_entry_md5_];
« no previous file with comments | « no previous file | components/open_from_clipboard/clipboard_recent_content_ios_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698