OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/process/process.h" | 19 #include "base/process/process.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
23 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
| 24 #include "base/time/time.h" |
24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
25 #include "ui/base/clipboard/clipboard_types.h" | 26 #include "ui/base/clipboard/clipboard_types.h" |
26 #include "ui/base/ui_base_export.h" | 27 #include "ui/base/ui_base_export.h" |
27 | 28 |
28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
29 #include <objidl.h> | 30 #include <objidl.h> |
30 #endif | 31 #endif |
31 | 32 |
32 class SkBitmap; | 33 class SkBitmap; |
33 | 34 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 base::string16* result) const = 0; | 198 base::string16* result) const = 0; |
198 | 199 |
199 // Reads a bookmark from the clipboard, if available. | 200 // Reads a bookmark from the clipboard, if available. |
200 virtual void ReadBookmark(base::string16* title, std::string* url) const = 0; | 201 virtual void ReadBookmark(base::string16* title, std::string* url) const = 0; |
201 | 202 |
202 // Reads raw data from the clipboard with the given format type. Stores result | 203 // Reads raw data from the clipboard with the given format type. Stores result |
203 // as a byte vector. | 204 // as a byte vector. |
204 virtual void ReadData(const FormatType& format, | 205 virtual void ReadData(const FormatType& format, |
205 std::string* result) const = 0; | 206 std::string* result) const = 0; |
206 | 207 |
| 208 // Returns an estimate of the time the clipboard was last updated. If the |
| 209 // time is unknown, returns Time::Time(). |
| 210 virtual base::Time GetClipboardLastModifiedTime() const; |
| 211 |
207 // Gets the FormatType corresponding to an arbitrary format string, | 212 // Gets the FormatType corresponding to an arbitrary format string, |
208 // registering it with the system if needed. Due to Windows/Linux | 213 // registering it with the system if needed. Due to Windows/Linux |
209 // limitiations, |format_string| must never be controlled by the user. | 214 // limitiations, |format_string| must never be controlled by the user. |
210 static FormatType GetFormatType(const std::string& format_string); | 215 static FormatType GetFormatType(const std::string& format_string); |
211 | 216 |
212 // Get format identifiers for various types. | 217 // Get format identifiers for various types. |
213 static const FormatType& GetUrlFormatType(); | 218 static const FormatType& GetUrlFormatType(); |
214 static const FormatType& GetUrlWFormatType(); | 219 static const FormatType& GetUrlWFormatType(); |
215 static const FormatType& GetMozUrlFormatType(); | 220 static const FormatType& GetMozUrlFormatType(); |
216 static const FormatType& GetPlainTextFormatType(); | 221 static const FormatType& GetPlainTextFormatType(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 345 |
341 // Mutex that controls access to |g_clipboard_map|. | 346 // Mutex that controls access to |g_clipboard_map|. |
342 static base::LazyInstance<base::Lock>::Leaky clipboard_map_lock_; | 347 static base::LazyInstance<base::Lock>::Leaky clipboard_map_lock_; |
343 | 348 |
344 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 349 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
345 }; | 350 }; |
346 | 351 |
347 } // namespace ui | 352 } // namespace ui |
348 | 353 |
349 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 354 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
OLD | NEW |