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

Side by Side Diff: chrome/common/os_exchange_data.cc

Issue 7441: Take 2 at fixing image corruption on drag and drop.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 | « base/clipboard_util.cc ('k') | chrome/common/os_exchange_data_unittest.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) 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 <shlobj.h> 5 #include <shlobj.h>
6 6
7 #include "chrome/common/os_exchange_data.h" 7 #include "chrome/common/os_exchange_data.h"
8 8
9 #include "base/clipboard_util.h" 9 #include "base/clipboard_util.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 323 }
324 324
325 void OSExchangeData::SetFileContents(const std::wstring& filename, 325 void OSExchangeData::SetFileContents(const std::wstring& filename,
326 const std::string& file_contents) { 326 const std::string& file_contents) {
327 // Add CFSTR_FILEDESCRIPTOR 327 // Add CFSTR_FILEDESCRIPTOR
328 STGMEDIUM* storage = GetStorageForFileDescriptor(filename); 328 STGMEDIUM* storage = GetStorageForFileDescriptor(filename);
329 contents_.push_back(new StoredDataInfo( 329 contents_.push_back(new StoredDataInfo(
330 ClipboardUtil::GetFileDescriptorFormat()->cfFormat, storage)); 330 ClipboardUtil::GetFileDescriptorFormat()->cfFormat, storage));
331 331
332 // Add CFSTR_FILECONTENTS 332 // Add CFSTR_FILECONTENTS
333 storage = GetStorageForString(file_contents); 333 storage = GetStorageForBytes(file_contents.data(), file_contents.length());
334 contents_.push_back(new StoredDataInfo( 334 contents_.push_back(new StoredDataInfo(
335 ClipboardUtil::GetFileContentFormatZero()->cfFormat, storage)); 335 ClipboardUtil::GetFileContentFormatZero()->cfFormat, storage));
336 } 336 }
337 337
338 void OSExchangeData::SetCFHtml(const std::wstring& cf_html) { 338 void OSExchangeData::SetCFHtml(const std::wstring& cf_html) {
339 std::string utf8 = WideToUTF8(cf_html); 339 std::string utf8 = WideToUTF8(cf_html);
340 STGMEDIUM* storage = GetStorageForBytes(utf8.c_str(), utf8.size()); 340 STGMEDIUM* storage = GetStorageForBytes(utf8.c_str(), utf8.size());
341 contents_.push_back(new StoredDataInfo( 341 contents_.push_back(new StoredDataInfo(
342 ClipboardUtil::GetHtmlFormat()->cfFormat, storage)); 342 ClipboardUtil::GetHtmlFormat()->cfFormat, storage));
343 } 343 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 686
687 GlobalUnlock(handle); 687 GlobalUnlock(handle);
688 688
689 STGMEDIUM* storage = new STGMEDIUM; 689 STGMEDIUM* storage = new STGMEDIUM;
690 storage->hGlobal = handle; 690 storage->hGlobal = handle;
691 storage->tymed = TYMED_HGLOBAL; 691 storage->tymed = TYMED_HGLOBAL;
692 storage->pUnkForRelease = NULL; 692 storage->pUnkForRelease = NULL;
693 return storage; 693 return storage;
694 } 694 }
695 695
OLDNEW
« no previous file with comments | « base/clipboard_util.cc ('k') | chrome/common/os_exchange_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698