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

Side by Side Diff: content/renderer/webclipboard_impl.cc

Issue 121033002: Update uses of UTF conversions in content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
« no previous file with comments | « content/renderer/web_preferences.cc ('k') | content/shell/app/shell_breakpad_client.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/webclipboard_impl.h" 5 #include "content/renderer/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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 client_->ReadText(clipboard_type, &text); 100 client_->ReadText(clipboard_type, &text);
101 if (!text.empty()) 101 if (!text.empty())
102 return text; 102 return text;
103 } 103 }
104 104
105 if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), 105 if (client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
106 clipboard_type)) { 106 clipboard_type)) {
107 std::string text; 107 std::string text;
108 client_->ReadAsciiText(clipboard_type, &text); 108 client_->ReadAsciiText(clipboard_type, &text);
109 if (!text.empty()) 109 if (!text.empty())
110 return ASCIIToUTF16(text); 110 return base::ASCIIToUTF16(text);
111 } 111 }
112 112
113 return WebString(); 113 return WebString();
114 } 114 }
115 115
116 WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url, 116 WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url,
117 unsigned* fragment_start, 117 unsigned* fragment_start,
118 unsigned* fragment_end) { 118 unsigned* fragment_end) {
119 ui::ClipboardType clipboard_type; 119 ui::ClipboardType clipboard_type;
120 if (!ConvertBufferType(buffer, &clipboard_type)) 120 if (!ConvertBufferType(buffer, &clipboard_type))
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (!url.isEmpty()) { 180 if (!url.isEmpty()) {
181 scw.WriteBookmark(title, url.spec()); 181 scw.WriteBookmark(title, url.spec());
182 #if !defined(OS_MACOSX) 182 #if !defined(OS_MACOSX)
183 // When writing the image, we also write the image markup so that pasting 183 // When writing the image, we also write the image markup so that pasting
184 // into rich text editors, such as Gmail, reveals the image. We also don't 184 // into rich text editors, such as Gmail, reveals the image. We also don't
185 // want to call writeText(), since some applications (WordPad) don't pick 185 // want to call writeText(), since some applications (WordPad) don't pick
186 // the image if there is also a text format on the clipboard. 186 // the image if there is also a text format on the clipboard.
187 // We also don't want to write HTML on a Mac, since Mail.app prefers to use 187 // We also don't want to write HTML on a Mac, since Mail.app prefers to use
188 // the image markup over attaching the actual image. See 188 // the image markup over attaching the actual image. See
189 // http://crbug.com/33016 for details. 189 // http://crbug.com/33016 for details.
190 scw.WriteHTML(UTF8ToUTF16(URLToImageMarkup(url, title)), std::string()); 190 scw.WriteHTML(base::UTF8ToUTF16(URLToImageMarkup(url, title)),
191 std::string());
191 #endif 192 #endif
192 } 193 }
193 } 194 }
194 195
195 void WebClipboardImpl::writeDataObject(const WebDragData& data) { 196 void WebClipboardImpl::writeDataObject(const WebDragData& data) {
196 ScopedClipboardWriterGlue scw(client_); 197 ScopedClipboardWriterGlue scw(client_);
197 198
198 const DropData& data_object = DropDataBuilder::Build(data); 199 const DropData& data_object = DropDataBuilder::Build(data);
199 // TODO(dcheng): Properly support text/uri-list here. 200 // TODO(dcheng): Properly support text/uri-list here.
200 if (!data_object.text.is_null()) 201 if (!data_object.text.is_null())
(...skipping 30 matching lines...) Expand all
231 #endif 232 #endif
232 #endif 233 #endif
233 default: 234 default:
234 NOTREACHED(); 235 NOTREACHED();
235 return false; 236 return false;
236 } 237 }
237 return true; 238 return true;
238 } 239 }
239 240
240 } // namespace content 241 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/web_preferences.cc ('k') | content/shell/app/shell_breakpad_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698