OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/scoped_clipboard_writer.h" | 5 #include "base/scoped_clipboard_writer.h" |
6 | 6 |
7 #include "base/clipboard.h" | 7 #include "base/clipboard.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 | 9 |
10 ScopedClipboardWriter::ScopedClipboardWriter(Clipboard* clipboard) | 10 ScopedClipboardWriter::ScopedClipboardWriter(Clipboard* clipboard) |
(...skipping 20 matching lines...) Expand all Loading... |
31 void ScopedClipboardWriter::WriteHTML(const std::wstring& markup, | 31 void ScopedClipboardWriter::WriteHTML(const std::wstring& markup, |
32 const std::string& src_url) { | 32 const std::string& src_url) { |
33 if (markup.empty()) | 33 if (markup.empty()) |
34 return; | 34 return; |
35 | 35 |
36 std::string utf8_markup = WideToUTF8(markup); | 36 std::string utf8_markup = WideToUTF8(markup); |
37 | 37 |
38 Clipboard::ObjectMapParams params; | 38 Clipboard::ObjectMapParams params; |
39 params.push_back( | 39 params.push_back( |
40 Clipboard::ObjectMapParam(utf8_markup.begin(), | 40 Clipboard::ObjectMapParam(utf8_markup.begin(), |
41 utf8_markup.end())); | 41 utf8_markup.end())); |
42 if (!src_url.empty()) { | 42 if (!src_url.empty()) { |
43 params.push_back(Clipboard::ObjectMapParam(src_url.begin(), | 43 params.push_back(Clipboard::ObjectMapParam(src_url.begin(), |
44 src_url.end())); | 44 src_url.end())); |
45 } | 45 } |
46 | 46 |
47 objects_[Clipboard::CBF_HTML] = params; | 47 objects_[Clipboard::CBF_HTML] = params; |
48 } | 48 } |
49 | 49 |
50 void ScopedClipboardWriter::WriteBookmark(const std::wstring& title, | 50 void ScopedClipboardWriter::WriteBookmark(const std::wstring& title, |
51 const std::string& url) { | 51 const std::string& url) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 size_t size_len = sizeof(gfx::Size); | 121 size_t size_len = sizeof(gfx::Size); |
122 for (size_t i = 0; i < size_len; i++) | 122 for (size_t i = 0; i < size_len; i++) |
123 param2.push_back(size_data[i]); | 123 param2.push_back(size_data[i]); |
124 | 124 |
125 Clipboard::ObjectMapParams params; | 125 Clipboard::ObjectMapParams params; |
126 params.push_back(param1); | 126 params.push_back(param1); |
127 params.push_back(param2); | 127 params.push_back(param2); |
128 objects_[Clipboard::CBF_BITMAP] = params; | 128 objects_[Clipboard::CBF_BITMAP] = params; |
129 } | 129 } |
130 #endif // defined(OS_WIN) | 130 #endif // defined(OS_WIN) |
OLD | NEW |