OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_impl_ios.h" | 5 #import "components/open_from_clipboard/clipboard_recent_content_impl_ios.h" |
6 | 6 |
7 #import <CommonCrypto/CommonDigest.h> | 7 #import <CommonCrypto/CommonDigest.h> |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return changeCountChanged; | 143 return changeCountChanged; |
144 } | 144 } |
145 | 145 |
146 BOOL md5Changed = | 146 BOOL md5Changed = |
147 ![[self getCurrentMD5] isEqualToData:self.lastPasteboardEntryMD5]; | 147 ![[self getCurrentMD5] isEqualToData:self.lastPasteboardEntryMD5]; |
148 return md5Changed; | 148 return md5Changed; |
149 } | 149 } |
150 | 150 |
151 - (NSURL*)recentURLFromClipboard { | 151 - (NSURL*)recentURLFromClipboard { |
152 [self updateIfNeeded]; | 152 [self updateIfNeeded]; |
153 if ([self clipboardContentAge] > kMaximumAgeOfClipboard) { | 153 if ([self clipboardContentAge] > MaximumAgeOfClipboard()) { |
154 return nil; | 154 return nil; |
155 } | 155 } |
156 return [self URLFromPasteboard]; | 156 return [self URLFromPasteboard]; |
157 } | 157 } |
158 | 158 |
159 - (NSTimeInterval)clipboardContentAge { | 159 - (NSTimeInterval)clipboardContentAge { |
160 return -[self.lastPasteboardChangeDate timeIntervalSinceNow]; | 160 return -[self.lastPasteboardChangeDate timeIntervalSinceNow]; |
161 } | 161 } |
162 | 162 |
163 - (void)suppressClipboardContent { | 163 - (void)suppressClipboardContent { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 forKey:kPasteboardChangeDateKey]; | 208 forKey:kPasteboardChangeDateKey]; |
209 [self.sharedUserDefaults setObject:self.lastPasteboardEntryMD5 | 209 [self.sharedUserDefaults setObject:self.lastPasteboardEntryMD5 |
210 forKey:kPasteboardEntryMD5Key]; | 210 forKey:kPasteboardEntryMD5Key]; |
211 } | 211 } |
212 | 212 |
213 - (NSTimeInterval)uptime { | 213 - (NSTimeInterval)uptime { |
214 return base::SysInfo::Uptime().InSecondsF(); | 214 return base::SysInfo::Uptime().InSecondsF(); |
215 } | 215 } |
216 | 216 |
217 @end | 217 @end |
OLD | NEW |