| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 CC_MD5(c_string, strlen(c_string), hash); | 94 CC_MD5(c_string, strlen(c_string), hash); |
| 95 NSData* data = [NSData dataWithBytes:hash length:4]; | 95 NSData* data = [NSData dataWithBytes:hash length:4]; |
| 96 return data; | 96 return data; |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace | 99 } // namespace |
| 100 | 100 |
| 101 bool ClipboardRecentContentIOS::GetRecentURLFromClipboard(GURL* url) { | 101 bool ClipboardRecentContentIOS::GetRecentURLFromClipboard(GURL* url) { |
| 102 DCHECK(url); | 102 DCHECK(url); |
| 103 UpdateIfNeeded(); | 103 UpdateIfNeeded(); |
| 104 if (GetClipboardContentAge() > kMaximumAgeOfClipboard) { | 104 if (GetClipboardContentAge() > MaximumAgeOfClipboard()) { |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 GURL url_from_pasteboard = URLFromPasteboard(); | 108 GURL url_from_pasteboard = URLFromPasteboard(); |
| 109 if (url_from_pasteboard.is_valid()) { | 109 if (url_from_pasteboard.is_valid()) { |
| 110 *url = url_from_pasteboard; | 110 *url = url_from_pasteboard; |
| 111 return true; | 111 return true; |
| 112 } | 112 } |
| 113 return false; | 113 return false; |
| 114 } | 114 } |
| (...skipping 111 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 |