Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: ui/base/clipboard/scoped_clipboard_writer.h

Issue 9232075: Have ScopedClipboardWriter and Clipboard::WriteObjects take a buffer parameter. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Un-add myself to AUTHORS. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 11 matching lines...) Expand all
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_EXPORT 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,
sky 2012/02/16 01:39:03 no explicit
peter1 2012/02/17 18:45:41 Done.
33 Clipboard::Buffer buffer);
33 34
34 ~ScopedClipboardWriter(); 35 ~ScopedClipboardWriter();
35 36
36 // Converts |text| to UTF-8 and adds it to the clipboard. 37 // Converts |text| to UTF-8 and adds it to the clipboard.
37 void WriteText(const string16& text); 38 void WriteText(const string16& text);
38 39
39 // Converts the text of the URL to UTF-8 and adds it to the clipboard, then 40 // Converts the text of the URL to UTF-8 and adds it to the clipboard, then
40 // notifies the Clipboard that we just wrote a URL. 41 // notifies the Clipboard that we just wrote a URL.
41 void WriteURL(const string16& text); 42 void WriteURL(const string16& text);
42 43
(...skipping 22 matching lines...) Expand all
65 66
66 protected: 67 protected:
67 // Converts |text| to UTF-8 and adds it to the clipboard. If it's a URL, we 68 // Converts |text| to UTF-8 and adds it to the clipboard. If it's a URL, we
68 // also notify the clipboard of that fact. 69 // also notify the clipboard of that fact.
69 void WriteTextOrURL(const string16& text, bool is_url); 70 void WriteTextOrURL(const string16& text, bool is_url);
70 71
71 // We accumulate the data passed to the various targets in the |objects_| 72 // We accumulate the data passed to the various targets in the |objects_|
72 // vector, and pass it to Clipboard::WriteObjects() during object destruction. 73 // vector, and pass it to Clipboard::WriteObjects() during object destruction.
73 Clipboard::ObjectMap objects_; 74 Clipboard::ObjectMap objects_;
74 Clipboard* clipboard_; 75 Clipboard* clipboard_;
76 Clipboard::Buffer buffer_;
75 77
76 // We keep around the UTF-8 text of the URL in order to pass it to 78 // We keep around the UTF-8 text of the URL in order to pass it to
77 // Clipboard::DidWriteURL(). 79 // Clipboard::DidWriteURL().
78 std::string url_text_; 80 std::string url_text_;
79 81
80 private: 82 private:
81 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); 83 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter);
82 }; 84 };
83 85
84 } // namespace ui 86 } // namespace ui
85 87
86 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ 88 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_
87 89
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698