OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file declares the ScopedClipboardWriter class, a wrapper around | 5 // This file declares the ScopedClipboardWriter class, a wrapper around |
6 // the Clipboard class which simplifies writing data to the system clipboard. | 6 // the Clipboard class which simplifies writing data to the system clipboard. |
7 // Upon deletion the class atomically writes all data to |clipboard_|, | 7 // Upon deletion the class atomically writes all data to |clipboard_|, |
8 // avoiding any potential race condition with other processes that are also | 8 // avoiding any potential race condition with other processes that are also |
9 // writing to the system clipboard. | 9 // writing to the system clipboard. |
10 | 10 |
11 #ifndef UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ | 11 #ifndef UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ |
12 #define UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ | 12 #define UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ |
13 #pragma once | 13 #pragma once |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/string16.h" | 17 #include "base/string16.h" |
18 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
19 #include "ui/ui_api.h" | 19 #include "ui/base/ui_export.h" |
20 | 20 |
21 class Pickle; | 21 class Pickle; |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
24 | 24 |
25 // This class is a wrapper for |Clipboard| that handles packing data | 25 // This class is a wrapper for |Clipboard| that handles packing data |
26 // into a Clipboard::ObjectMap. | 26 // into a Clipboard::ObjectMap. |
27 // NB: You should probably NOT be using this class if you include | 27 // NB: You should probably NOT be using this class if you include |
28 // webkit_glue.h. Use ScopedClipboardWriterGlue instead. | 28 // webkit_glue.h. Use ScopedClipboardWriterGlue instead. |
29 class UI_API ScopedClipboardWriter { | 29 class UI_EXPORT ScopedClipboardWriter { |
30 public: | 30 public: |
31 // Create an instance that is a simple wrapper around clipboard. | 31 // Create an instance that is a simple wrapper around clipboard. |
32 explicit ScopedClipboardWriter(Clipboard* clipboard); | 32 explicit ScopedClipboardWriter(Clipboard* clipboard); |
33 | 33 |
34 ~ScopedClipboardWriter(); | 34 ~ScopedClipboardWriter(); |
35 | 35 |
36 // Converts |text| to UTF-8 and adds it to the clipboard. | 36 // Converts |text| to UTF-8 and adds it to the clipboard. |
37 void WriteText(const string16& text); | 37 void WriteText(const string16& text); |
38 | 38 |
39 // Converts the text of the URL to UTF-8 and adds it to the clipboard, then | 39 // Converts the text of the URL to UTF-8 and adds it to the clipboard, then |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 std::string url_text_; | 77 std::string url_text_; |
78 | 78 |
79 private: | 79 private: |
80 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); | 80 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace ui | 83 } // namespace ui |
84 | 84 |
85 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ | 85 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ |
86 | 86 |
OLD | NEW |