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 "ui/base/dragdrop/os_exchange_data_provider_win.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
6 | 6 |
| 7 #include <objbase.h> |
7 #include <objidl.h> | 8 #include <objidl.h> |
8 #include <shlobj.h> | 9 #include <shlobj.h> |
9 #include <shobjidl.h> | 10 #include <shobjidl.h> |
10 #include <stdint.h> | 11 #include <stdint.h> |
11 | 12 |
12 #include <algorithm> | 13 #include <algorithm> |
13 #include <iterator> | 14 #include <iterator> |
14 | 15 |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/i18n/file_util_icu.h" | 17 #include "base/i18n/file_util_icu.h" |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 CreateDIBSection(screen_dc, reinterpret_cast<BITMAPINFO*>(&header), | 577 CreateDIBSection(screen_dc, reinterpret_cast<BITMAPINFO*>(&header), |
577 DIB_RGB_COLORS, &bits, NULL, 0); | 578 DIB_RGB_COLORS, &bits, NULL, 0); |
578 } | 579 } |
579 if (!hbitmap) | 580 if (!hbitmap) |
580 return; | 581 return; |
581 | 582 |
582 memcpy(bits, unpremul_bitmap.getPixels(), height * rowbytes); | 583 memcpy(bits, unpremul_bitmap.getPixels(), height * rowbytes); |
583 | 584 |
584 base::win::ScopedComPtr<IDragSourceHelper> helper; | 585 base::win::ScopedComPtr<IDragSourceHelper> helper; |
585 HRESULT rv = CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, | 586 HRESULT rv = CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, |
586 IID_IDragSourceHelper, helper.ReceiveVoid()); | 587 IID_PPV_ARGS(&helper)); |
587 if (!SUCCEEDED(rv)) | 588 if (!SUCCEEDED(rv)) |
588 return; | 589 return; |
589 | 590 |
590 // InitializeFromBitmap() takes ownership of |hbitmap|. | 591 // InitializeFromBitmap() takes ownership of |hbitmap|. |
591 SHDRAGIMAGE sdi; | 592 SHDRAGIMAGE sdi; |
592 sdi.sizeDragImage.cx = width; | 593 sdi.sizeDragImage.cx = width; |
593 sdi.sizeDragImage.cy = height; | 594 sdi.sizeDragImage.cy = height; |
594 sdi.crColorKey = 0xFFFFFFFF; | 595 sdi.crColorKey = 0xFFFFFFFF; |
595 sdi.hbmpDragImage = hbitmap; | 596 sdi.hbmpDragImage = hbitmap; |
596 sdi.ptOffset = gfx::PointAtOffsetFromOrigin(cursor_offset).ToPOINT(); | 597 sdi.ptOffset = gfx::PointAtOffsetFromOrigin(cursor_offset).ToPOINT(); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); | 1119 std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); |
1119 | 1120 |
1120 STGMEDIUM* storage = new STGMEDIUM; | 1121 STGMEDIUM* storage = new STGMEDIUM; |
1121 storage->tymed = TYMED_HGLOBAL; | 1122 storage->tymed = TYMED_HGLOBAL; |
1122 storage->hGlobal = hdata; | 1123 storage->hGlobal = hdata; |
1123 storage->pUnkForRelease = NULL; | 1124 storage->pUnkForRelease = NULL; |
1124 return storage; | 1125 return storage; |
1125 } | 1126 } |
1126 | 1127 |
1127 } // namespace ui | 1128 } // namespace ui |
OLD | NEW |