| OLD | NEW |
| 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 // Many of these functions are based on those found in | 5 // Many of these functions are based on those found in |
| 6 // webkit/port/platform/PasteboardWin.cpp | 6 // webkit/port/platform/PasteboardWin.cpp |
| 7 | 7 |
| 8 #include "ui/base/clipboard/clipboard.h" | 8 #include "ui/base/clipboard/clipboard.h" |
| 9 | 9 |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 ::EmptyClipboard(); | 221 ::EmptyClipboard(); |
| 222 | 222 |
| 223 for (ObjectMap::const_iterator iter = objects.begin(); | 223 for (ObjectMap::const_iterator iter = objects.begin(); |
| 224 iter != objects.end(); ++iter) { | 224 iter != objects.end(); ++iter) { |
| 225 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); | 225 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 void Clipboard::WriteText(const char* text_data, size_t text_len) { | 229 void Clipboard::WriteText(const char* text_data, size_t text_len) { |
| 230 string16 text; | 230 base::string16 text = |
| 231 UTF8ToUTF16(text_data, text_len, &text); | 231 base::UTF8ToUTF16(base::StringPiece(text_data, text_len)); |
| 232 HGLOBAL glob = CreateGlobalData(text); | 232 HGLOBAL glob = CreateGlobalData(text); |
| 233 | 233 |
| 234 WriteToClipboard(CF_UNICODETEXT, glob); | 234 WriteToClipboard(CF_UNICODETEXT, glob); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void Clipboard::WriteHTML(const char* markup_data, | 237 void Clipboard::WriteHTML(const char* markup_data, |
| 238 size_t markup_len, | 238 size_t markup_len, |
| 239 const char* url_data, | 239 const char* url_data, |
| 240 size_t url_len) { | 240 size_t url_len) { |
| 241 std::string markup(markup_data, markup_len); | 241 std::string markup(markup_data, markup_len); |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 if (!clipboard_owner_) | 825 if (!clipboard_owner_) |
| 826 return NULL; | 826 return NULL; |
| 827 | 827 |
| 828 if (clipboard_owner_->hwnd() == NULL) | 828 if (clipboard_owner_->hwnd() == NULL) |
| 829 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); | 829 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); |
| 830 | 830 |
| 831 return clipboard_owner_->hwnd(); | 831 return clipboard_owner_->hwnd(); |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace ui | 834 } // namespace ui |
| OLD | NEW |