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 #include "remoting/host/clipboard.h" | 5 #include "remoting/host/clipboard.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return; | 235 return; |
236 } | 236 } |
237 | 237 |
238 HGLOBAL text_global = clipboard.GetData(CF_UNICODETEXT); | 238 HGLOBAL text_global = clipboard.GetData(CF_UNICODETEXT); |
239 if (!text_global) { | 239 if (!text_global) { |
240 LOG(WARNING) << "Couldn't get data from the clipboard: " | 240 LOG(WARNING) << "Couldn't get data from the clipboard: " |
241 << GetLastError(); | 241 << GetLastError(); |
242 return; | 242 return; |
243 } | 243 } |
244 | 244 |
245 base::win::ScopedHGlobal<WCHAR> text_lock(text_global); | 245 base::win::ScopedHGlobal<WCHAR*> text_lock(text_global); |
246 if (!text_lock.get()) { | 246 if (!text_lock.get()) { |
247 LOG(WARNING) << "Couldn't lock clipboard data: " << GetLastError(); | 247 LOG(WARNING) << "Couldn't lock clipboard data: " << GetLastError(); |
248 return; | 248 return; |
249 } | 249 } |
250 text.assign(text_lock.get()); | 250 text.assign(text_lock.get()); |
251 } | 251 } |
252 | 252 |
253 protocol::ClipboardEvent event; | 253 protocol::ClipboardEvent event; |
254 event.set_mime_type(kMimeTypeTextUtf8); | 254 event.set_mime_type(kMimeTypeTextUtf8); |
255 event.set_data(ReplaceCrLfByLf(base::UTF16ToUTF8(text))); | 255 event.set_data(ReplaceCrLfByLf(base::UTF16ToUTF8(text))); |
(...skipping 13 matching lines...) Expand all Loading... |
269 } | 269 } |
270 | 270 |
271 return false; | 271 return false; |
272 } | 272 } |
273 | 273 |
274 scoped_ptr<Clipboard> Clipboard::Create() { | 274 scoped_ptr<Clipboard> Clipboard::Create() { |
275 return scoped_ptr<Clipboard>(new ClipboardWin()); | 275 return scoped_ptr<Clipboard>(new ClipboardWin()); |
276 } | 276 } |
277 | 277 |
278 } // namespace remoting | 278 } // namespace remoting |
OLD | NEW |