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

Side by Side Diff: base/clipboard_util.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 | « no previous file | chrome/common/os_exchange_data.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 "base/clipboard_util.h" 5 #include "base/clipboard_util.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlwapi.h> 8 #include <shlwapi.h>
9 #include <wininet.h> 9 #include <wininet.h>
10 10
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 if (!has_data) 350 if (!has_data)
351 return false; 351 return false;
352 352
353 STGMEDIUM content; 353 STGMEDIUM content;
354 // The call to GetData can be very slow depending on what is in 354 // The call to GetData can be very slow depending on what is in
355 // |data_object|. 355 // |data_object|.
356 if (SUCCEEDED(data_object->GetData(GetFileContentFormatZero(), &content))) { 356 if (SUCCEEDED(data_object->GetData(GetFileContentFormatZero(), &content))) {
357 if (TYMED_HGLOBAL == content.tymed) { 357 if (TYMED_HGLOBAL == content.tymed) {
358 ScopedHGlobal<char> data(content.hGlobal); 358 ScopedHGlobal<char> data(content.hGlobal);
359 // The size includes the trailing NULL byte. We don't want it. 359 file_contents->assign(data.get(), data.Size());
360 file_contents->assign(data.get(), data.Size() - 1);
361 } 360 }
362 ReleaseStgMedium(&content); 361 ReleaseStgMedium(&content);
363 } 362 }
364 363
365 STGMEDIUM description; 364 STGMEDIUM description;
366 if (SUCCEEDED(data_object->GetData(GetFileDescriptorFormat(), 365 if (SUCCEEDED(data_object->GetData(GetFileDescriptorFormat(),
367 &description))) { 366 &description))) {
368 ScopedHGlobal<FILEGROUPDESCRIPTOR> fgd(description.hGlobal); 367 ScopedHGlobal<FILEGROUPDESCRIPTOR> fgd(description.hGlobal);
369 // We expect there to be at least one file in here. 368 // We expect there to be at least one file in here.
370 DCHECK(fgd->cItems >= 1); 369 DCHECK(fgd->cItems >= 1);
371 filename->assign(fgd->fgd[0].cFileName); 370 filename->assign(fgd->fgd[0].cFileName);
372 ReleaseStgMedium(&description); 371 ReleaseStgMedium(&description);
373 } 372 }
374 return true; 373 return true;
375 } 374 }
376 375
OLDNEW
« no previous file with comments | « no previous file | chrome/common/os_exchange_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698