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

Side by Side Diff: webkit/glue/webclipboard_impl.cc

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 #include "webkit/glue/webclipboard_impl.h" 5 #include "webkit/glue/webclipboard_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 default: 106 default:
107 NOTREACHED(); 107 NOTREACHED();
108 } 108 }
109 109
110 return false; 110 return false;
111 } 111 }
112 112
113 WebVector<WebString> WebClipboardImpl::readAvailableTypes( 113 WebVector<WebString> WebClipboardImpl::readAvailableTypes(
114 Buffer buffer, bool* contains_filenames) { 114 Buffer buffer, bool* contains_filenames) {
115 ui::Clipboard::Buffer buffer_type; 115 ui::Clipboard::Buffer buffer_type;
116 std::vector<string16> types; 116 std::vector<base::string16> types;
117 if (ConvertBufferType(buffer, &buffer_type)) { 117 if (ConvertBufferType(buffer, &buffer_type)) {
118 client_->ReadAvailableTypes(buffer_type, &types, contains_filenames); 118 client_->ReadAvailableTypes(buffer_type, &types, contains_filenames);
119 } 119 }
120 return types; 120 return types;
121 } 121 }
122 122
123 WebString WebClipboardImpl::readPlainText(Buffer buffer) { 123 WebString WebClipboardImpl::readPlainText(Buffer buffer) {
124 ui::Clipboard::Buffer buffer_type; 124 ui::Clipboard::Buffer buffer_type;
125 if (!ConvertBufferType(buffer, &buffer_type)) 125 if (!ConvertBufferType(buffer, &buffer_type))
126 return WebString(); 126 return WebString();
127 127
128 if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), 128 if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(),
129 buffer_type)) { 129 buffer_type)) {
130 string16 text; 130 base::string16 text;
131 client_->ReadText(buffer_type, &text); 131 client_->ReadText(buffer_type, &text);
132 if (!text.empty()) 132 if (!text.empty())
133 return text; 133 return text;
134 } 134 }
135 135
136 if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), 136 if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
137 buffer_type)) { 137 buffer_type)) {
138 std::string text; 138 std::string text;
139 client_->ReadAsciiText(buffer_type, &text); 139 client_->ReadAsciiText(buffer_type, &text);
140 if (!text.empty()) 140 if (!text.empty())
141 return ASCIIToUTF16(text); 141 return ASCIIToUTF16(text);
142 } 142 }
143 143
144 return WebString(); 144 return WebString();
145 } 145 }
146 146
147 WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url, 147 WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url,
148 unsigned* fragment_start, 148 unsigned* fragment_start,
149 unsigned* fragment_end) { 149 unsigned* fragment_end) {
150 ui::Clipboard::Buffer buffer_type; 150 ui::Clipboard::Buffer buffer_type;
151 if (!ConvertBufferType(buffer, &buffer_type)) 151 if (!ConvertBufferType(buffer, &buffer_type))
152 return WebString(); 152 return WebString();
153 153
154 string16 html_stdstr; 154 base::string16 html_stdstr;
155 GURL gurl; 155 GURL gurl;
156 client_->ReadHTML(buffer_type, &html_stdstr, &gurl, 156 client_->ReadHTML(buffer_type, &html_stdstr, &gurl,
157 static_cast<uint32*>(fragment_start), 157 static_cast<uint32*>(fragment_start),
158 static_cast<uint32*>(fragment_end)); 158 static_cast<uint32*>(fragment_end));
159 *source_url = gurl; 159 *source_url = gurl;
160 return html_stdstr; 160 return html_stdstr;
161 } 161 }
162 162
163 WebData WebClipboardImpl::readImage(Buffer buffer) { 163 WebData WebClipboardImpl::readImage(Buffer buffer) {
164 ui::Clipboard::Buffer buffer_type; 164 ui::Clipboard::Buffer buffer_type;
165 if (!ConvertBufferType(buffer, &buffer_type)) 165 if (!ConvertBufferType(buffer, &buffer_type))
166 return WebData(); 166 return WebData();
167 167
168 std::string png_data; 168 std::string png_data;
169 client_->ReadImage(buffer_type, &png_data); 169 client_->ReadImage(buffer_type, &png_data);
170 return WebData(png_data); 170 return WebData(png_data);
171 } 171 }
172 172
173 WebString WebClipboardImpl::readCustomData(Buffer buffer, 173 WebString WebClipboardImpl::readCustomData(Buffer buffer,
174 const WebString& type) { 174 const WebString& type) {
175 ui::Clipboard::Buffer buffer_type; 175 ui::Clipboard::Buffer buffer_type;
176 if (!ConvertBufferType(buffer, &buffer_type)) 176 if (!ConvertBufferType(buffer, &buffer_type))
177 return WebString(); 177 return WebString();
178 178
179 string16 data; 179 base::string16 data;
180 client_->ReadCustomData(buffer_type, type, &data); 180 client_->ReadCustomData(buffer_type, type, &data);
181 return data; 181 return data;
182 } 182 }
183 183
184 void WebClipboardImpl::writeHTML( 184 void WebClipboardImpl::writeHTML(
185 const WebString& html_text, const WebURL& source_url, 185 const WebString& html_text, const WebURL& source_url,
186 const WebString& plain_text, bool write_smart_paste) { 186 const WebString& plain_text, bool write_smart_paste) {
187 ScopedClipboardWriterGlue scw(client_); 187 ScopedClipboardWriterGlue scw(client_);
188 scw.WriteHTML(html_text, source_url.spec()); 188 scw.WriteHTML(html_text, source_url.spec());
189 scw.WriteText(plain_text); 189 scw.WriteText(plain_text);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 #endif 269 #endif
270 #endif 270 #endif
271 default: 271 default:
272 NOTREACHED(); 272 NOTREACHED();
273 return false; 273 return false;
274 } 274 }
275 return true; 275 return true;
276 } 276 }
277 277
278 } // namespace webkit_glue 278 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698