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

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

Issue 12041078: Clear the clipboard closing Incognito window (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge and compilation fixes Created 7 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
« no previous file with comments | « ui/base/clipboard/clipboard_win.cc ('k') | ui/base/clipboard/scoped_clipboard_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 |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 12 matching lines...) Expand all
23 23
24 // This class is a wrapper for |Clipboard| that handles packing data 24 // This class is a wrapper for |Clipboard| that handles packing data
25 // into a Clipboard::ObjectMap. 25 // into a Clipboard::ObjectMap.
26 // NB: You should probably NOT be using this class if you include 26 // NB: You should probably NOT be using this class if you include
27 // webkit_glue.h. Use ScopedClipboardWriterGlue instead. 27 // webkit_glue.h. Use ScopedClipboardWriterGlue instead.
28 class UI_EXPORT ScopedClipboardWriter { 28 class UI_EXPORT ScopedClipboardWriter {
29 public: 29 public:
30 // Create an instance that is a simple wrapper around clipboard. 30 // Create an instance that is a simple wrapper around clipboard.
31 ScopedClipboardWriter(Clipboard* clipboard, Clipboard::Buffer buffer); 31 ScopedClipboardWriter(Clipboard* clipboard, Clipboard::Buffer buffer);
32 32
33 ScopedClipboardWriter(Clipboard* clipboard,
34 Clipboard::Buffer buffer,
35 Clipboard::SourceTag source_tag);
36
33 ~ScopedClipboardWriter(); 37 ~ScopedClipboardWriter();
34 38
35 // Converts |text| to UTF-8 and adds it to the clipboard. 39 // Converts |text| to UTF-8 and adds it to the clipboard.
36 void WriteText(const string16& text); 40 void WriteText(const string16& text);
37 41
38 // Converts the text of the URL to UTF-8 and adds it to the clipboard, then 42 // Converts the text of the URL to UTF-8 and adds it to the clipboard, then
39 // notifies the Clipboard that we just wrote a URL. 43 // notifies the Clipboard that we just wrote a URL.
40 void WriteURL(const string16& text); 44 void WriteURL(const string16& text);
41 45
42 // Adds HTML to the clipboard. The url parameter is optional, but especially 46 // Adds HTML to the clipboard. The url parameter is optional, but especially
(...skipping 28 matching lines...) Expand all
71 protected: 75 protected:
72 // Converts |text| to UTF-8 and adds it to the clipboard. If it's a URL, we 76 // Converts |text| to UTF-8 and adds it to the clipboard. If it's a URL, we
73 // also notify the clipboard of that fact. 77 // also notify the clipboard of that fact.
74 void WriteTextOrURL(const string16& text, bool is_url); 78 void WriteTextOrURL(const string16& text, bool is_url);
75 79
76 // We accumulate the data passed to the various targets in the |objects_| 80 // We accumulate the data passed to the various targets in the |objects_|
77 // vector, and pass it to Clipboard::WriteObjects() during object destruction. 81 // vector, and pass it to Clipboard::WriteObjects() during object destruction.
78 Clipboard::ObjectMap objects_; 82 Clipboard::ObjectMap objects_;
79 Clipboard* clipboard_; 83 Clipboard* clipboard_;
80 Clipboard::Buffer buffer_; 84 Clipboard::Buffer buffer_;
85 Clipboard::SourceTag source_tag_;
81 86
82 // We keep around the UTF-8 text of the URL in order to pass it to 87 // We keep around the UTF-8 text of the URL in order to pass it to
83 // Clipboard::DidWriteURL(). 88 // Clipboard::DidWriteURL().
84 std::string url_text_; 89 std::string url_text_;
85 90
86 private: 91 private:
87 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); 92 DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter);
88 }; 93 };
89 94
90 } // namespace ui 95 } // namespace ui
91 96
92 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ 97 #endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_
93 98
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_win.cc ('k') | ui/base/clipboard/scoped_clipboard_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698