Chromium Code Reviews| 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 // 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 the clipboard, | 7 // Upon deletion the class atomically writes all data to the 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 const std::string& url); | 54 const std::string& url); |
| 55 | 55 |
| 56 // Adds an html hyperlink (<a href>) to the clipboard. |anchor_text| and | 56 // Adds an html hyperlink (<a href>) to the clipboard. |anchor_text| and |
| 57 // |url| will be escaped as needed. | 57 // |url| will be escaped as needed. |
| 58 void WriteHyperlink(const base::string16& anchor_text, | 58 void WriteHyperlink(const base::string16& anchor_text, |
| 59 const std::string& url); | 59 const std::string& url); |
| 60 | 60 |
| 61 // Used by WebKit to determine whether WebKit wrote the clipboard last | 61 // Used by WebKit to determine whether WebKit wrote the clipboard last |
| 62 void WriteWebSmartPaste(); | 62 void WriteWebSmartPaste(); |
| 63 | 63 |
| 64 // Adds arbitrary data to clipboard. | |
|
dcheng
2017/04/05 08:40:39
Nit: Adds -> Write
| |
| 65 void WriteData(const char* data, | |
| 66 int size, | |
|
dcheng
2017/04/05 08:40:39
Please use size_t for the external interface.
| |
| 67 const Clipboard::FormatType& format); | |
| 68 | |
| 64 // Adds arbitrary pickled data to clipboard. | 69 // Adds arbitrary pickled data to clipboard. |
| 65 void WritePickledData(const base::Pickle& pickle, | 70 void WritePickledData(const base::Pickle& pickle, |
| 66 const Clipboard::FormatType& format); | 71 const Clipboard::FormatType& format); |
| 67 | 72 |
| 68 void WriteImage(const SkBitmap& bitmap); | 73 void WriteImage(const SkBitmap& bitmap); |
| 69 | 74 |
| 70 // Removes all objects that would be written to the clipboard. | 75 // Removes all objects that would be written to the clipboard. |
| 71 void Reset(); | 76 void Reset(); |
| 72 | 77 |
| 73 private: | 78 private: |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 86 // Clipboard::DidWriteURL(). | 91 // Clipboard::DidWriteURL(). |
| 87 std::string url_text_; | 92 std::string url_text_; |
| 88 | 93 |
| 89 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); | 94 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); |
| 90 }; | 95 }; |
| 91 | 96 |
| 92 } // namespace ui | 97 } // namespace ui |
| 93 | 98 |
| 94 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ | 99 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ |
| 95 | 100 |
| OLD | NEW |