| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "components/open_from_clipboard/clipboard_recent_content_ios.h" | 5 #import "components/open_from_clipboard/clipboard_recent_content_ios.h" |
| 6 | 6 |
| 7 #import <CommonCrypto/CommonDigest.h> | 7 #import <CommonCrypto/CommonDigest.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #import <UIKit/UIKit.h> | 10 #import <UIKit/UIKit.h> |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // omnibox list. Force entry expiration by setting copy date to 1970. | 123 // omnibox list. Force entry expiration by setting copy date to 1970. |
| 124 last_pasteboard_change_date_.reset( | 124 last_pasteboard_change_date_.reset( |
| 125 [[NSDate alloc] initWithTimeIntervalSince1970:0]); | 125 [[NSDate alloc] initWithTimeIntervalSince1970:0]); |
| 126 SaveToUserDefaults(); | 126 SaveToUserDefaults(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ClipboardRecentContentIOS::UpdateIfNeeded() { | 129 void ClipboardRecentContentIOS::UpdateIfNeeded() { |
| 130 if (!HasPasteboardChanged()) | 130 if (!HasPasteboardChanged()) |
| 131 return; | 131 return; |
| 132 | 132 |
| 133 base::RecordAction(base::UserMetricsAction("MobileOmniboxClipboardChanged")); | 133 base::RecordAction(base::UserMetricsAction("MobileClipboardChanged")); |
| 134 | 134 |
| 135 GURL url_from_pasteboard = URLFromPasteboard(); | 135 GURL url_from_pasteboard = URLFromPasteboard(); |
| 136 last_pasteboard_change_date_.reset([[NSDate date] retain]); | 136 last_pasteboard_change_date_.reset([[NSDate date] retain]); |
| 137 last_pasteboard_change_count_ = [UIPasteboard generalPasteboard].changeCount; | 137 last_pasteboard_change_count_ = [UIPasteboard generalPasteboard].changeCount; |
| 138 NSString* pasteboard_string = [[UIPasteboard generalPasteboard] string]; | 138 NSString* pasteboard_string = [[UIPasteboard generalPasteboard] string]; |
| 139 if (!pasteboard_string) { | 139 if (!pasteboard_string) { |
| 140 pasteboard_string = @""; | 140 pasteboard_string = @""; |
| 141 } | 141 } |
| 142 NSData* MD5 = WeakMD5FromNSString(pasteboard_string); | 142 NSData* MD5 = WeakMD5FromNSString(pasteboard_string); |
| 143 last_pasteboard_entry_md5_.reset([MD5 retain]); | 143 last_pasteboard_entry_md5_.reset([MD5 retain]); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 forKey:kPasteboardChangeCountKey]; | 226 forKey:kPasteboardChangeCountKey]; |
| 227 [shared_user_defaults_ setObject:last_pasteboard_change_date_ | 227 [shared_user_defaults_ setObject:last_pasteboard_change_date_ |
| 228 forKey:kPasteboardChangeDateKey]; | 228 forKey:kPasteboardChangeDateKey]; |
| 229 [shared_user_defaults_ setObject:last_pasteboard_entry_md5_ | 229 [shared_user_defaults_ setObject:last_pasteboard_entry_md5_ |
| 230 forKey:kPasteboardEntryMD5Key]; | 230 forKey:kPasteboardEntryMD5Key]; |
| 231 } | 231 } |
| 232 | 232 |
| 233 base::TimeDelta ClipboardRecentContentIOS::Uptime() const { | 233 base::TimeDelta ClipboardRecentContentIOS::Uptime() const { |
| 234 return base::SysInfo::Uptime(); | 234 return base::SysInfo::Uptime(); |
| 235 } | 235 } |
| OLD | NEW |