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 #ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ | 5 #ifndef COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ |
6 #define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ | 6 #define COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ |
7 | 7 |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 NSUserDefaults* group_user_defaults); | 30 NSUserDefaults* group_user_defaults); |
31 ~ClipboardRecentContentIOS() override; | 31 ~ClipboardRecentContentIOS() override; |
32 | 32 |
33 // Notifies that the content of the pasteboard may have changed. | 33 // Notifies that the content of the pasteboard may have changed. |
34 void PasteboardChanged(); | 34 void PasteboardChanged(); |
35 | 35 |
36 // Checks if pasteboard changed since last time a pasteboard change was | 36 // Checks if pasteboard changed since last time a pasteboard change was |
37 // registered. | 37 // registered. |
38 bool HasPasteboardChanged(base::TimeDelta uptime); | 38 bool HasPasteboardChanged(base::TimeDelta uptime); |
39 | 39 |
| 40 // Gets the current URL in the clipboard. If the cache is out of date, updates |
| 41 // it. |
| 42 bool GetCurrentURLFromClipboard(GURL* url); |
| 43 |
40 // Loads information from the user defaults about the latest pasteboard entry. | 44 // Loads information from the user defaults about the latest pasteboard entry. |
41 void LoadFromUserDefaults(); | 45 void LoadFromUserDefaults(); |
42 | 46 |
43 // ClipboardRecentContent implementation. | 47 // ClipboardRecentContent implementation. |
44 bool GetRecentURLFromClipboard(GURL* url) const override; | 48 bool GetRecentURLFromClipboard(GURL* url) const override; |
| 49 |
45 base::TimeDelta GetClipboardContentAge() const override; | 50 base::TimeDelta GetClipboardContentAge() const override; |
46 void SuppressClipboardContent() override; | 51 void SuppressClipboardContent() override; |
47 void RecentURLDisplayed() override; | 52 void RecentURLDisplayed() override; |
48 | 53 |
49 private: | 54 private: |
50 friend class ClipboardRecentContentIOSTest; | 55 friend class ClipboardRecentContentIOSTest; |
51 | 56 |
52 // Helper constructor for testing. |uptime| is how long ago the device has | 57 // Helper constructor for testing. |uptime| is how long ago the device has |
53 // started, while |application_scheme| has the same meaning as the public | 58 // started, while |application_scheme| has the same meaning as the public |
54 // constructor. | 59 // constructor. |
(...skipping 25 matching lines...) Expand all Loading... |
80 base::scoped_nsobject<PasteboardNotificationListenerBridge> | 85 base::scoped_nsobject<PasteboardNotificationListenerBridge> |
81 notification_bridge_; | 86 notification_bridge_; |
82 // The user defaults from the app group used to optimize the pasteboard change | 87 // The user defaults from the app group used to optimize the pasteboard change |
83 // detection. | 88 // detection. |
84 base::scoped_nsobject<NSUserDefaults> shared_user_defaults_; | 89 base::scoped_nsobject<NSUserDefaults> shared_user_defaults_; |
85 | 90 |
86 DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContentIOS); | 91 DISALLOW_COPY_AND_ASSIGN(ClipboardRecentContentIOS); |
87 }; | 92 }; |
88 | 93 |
89 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ | 94 #endif // COMPONENTS_OPEN_FROM_CLIPBOARD_CLIPBOARD_RECENT_CONTENT_IOS_H_ |
OLD | NEW |