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

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

Issue 9212066: Modified the flash cipboard interface to add html clipboard support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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) 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 implements the ScopedClipboardWriter class. Documentation on its 5 // This file implements the ScopedClipboardWriter class. Documentation on its
6 // purpose can be found in our header. Documentation on the format of the 6 // purpose can be found in our header. Documentation on the format of the
7 // parameters for each clipboard target can be found in clipboard.h. 7 // parameters for each clipboard target can be found in clipboard.h.
8 8
9 #include "ui/base/clipboard/scoped_clipboard_writer.h" 9 #include "ui/base/clipboard/scoped_clipboard_writer.h"
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 data_parameter.resize(pickle.size()); 116 data_parameter.resize(pickle.size());
117 memcpy(const_cast<char*>(&data_parameter.front()), 117 memcpy(const_cast<char*>(&data_parameter.front()),
118 pickle.data(), pickle.size()); 118 pickle.data(), pickle.size());
119 119
120 Clipboard::ObjectMapParams parameters; 120 Clipboard::ObjectMapParams parameters;
121 parameters.push_back(format_parameter); 121 parameters.push_back(format_parameter);
122 parameters.push_back(data_parameter); 122 parameters.push_back(data_parameter);
123 objects_[Clipboard::CBF_DATA] = parameters; 123 objects_[Clipboard::CBF_DATA] = parameters;
124 } 124 }
125 125
126 void ScopedClipboardWriter::Reset() {
127 url_text_.clear();
128 objects_.clear();
129 }
130
126 void ScopedClipboardWriter::WriteTextOrURL(const string16& text, bool is_url) { 131 void ScopedClipboardWriter::WriteTextOrURL(const string16& text, bool is_url) {
127 if (text.empty()) 132 if (text.empty())
128 return; 133 return;
129 134
130 std::string utf8_text = UTF16ToUTF8(text); 135 std::string utf8_text = UTF16ToUTF8(text);
131 136
132 Clipboard::ObjectMapParams parameters; 137 Clipboard::ObjectMapParams parameters;
133 parameters.push_back(Clipboard::ObjectMapParam(utf8_text.begin(), 138 parameters.push_back(Clipboard::ObjectMapParam(utf8_text.begin(),
134 utf8_text.end())); 139 utf8_text.end()));
135 objects_[Clipboard::CBF_TEXT] = parameters; 140 objects_[Clipboard::CBF_TEXT] = parameters;
136 141
137 if (is_url) { 142 if (is_url) {
138 url_text_ = utf8_text; 143 url_text_ = utf8_text;
139 } else { 144 } else {
140 url_text_.clear(); 145 url_text_.clear();
141 } 146 }
142 } 147 }
143 148
144 } // namespace ui 149 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/scoped_clipboard_writer.h ('k') | webkit/plugins/ppapi/mock_plugin_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698