| 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 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ |
| 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ |
| 7 | 7 |
| 8 #include <objidl.h> | 8 #include <objidl.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Removes from contents_ the first data that matches |format|. | 97 // Removes from contents_ the first data that matches |format|. |
| 98 void RemoveData(const FORMATETC& format); | 98 void RemoveData(const FORMATETC& format); |
| 99 | 99 |
| 100 // Our internal representation of stored data & type info. | 100 // Our internal representation of stored data & type info. |
| 101 struct StoredDataInfo { | 101 struct StoredDataInfo { |
| 102 FORMATETC format_etc; | 102 FORMATETC format_etc; |
| 103 STGMEDIUM* medium; | 103 STGMEDIUM* medium; |
| 104 bool owns_medium; | 104 bool owns_medium; |
| 105 scoped_refptr<DownloadFileProvider> downloader; | 105 scoped_refptr<DownloadFileProvider> downloader; |
| 106 | 106 |
| 107 StoredDataInfo(const FORMATETC& format_etc, STGMEDIUM* medium) | 107 StoredDataInfo(const FORMATETC& format_etc, STGMEDIUM* medium); |
| 108 : format_etc(format_etc), medium(medium), owns_medium(true) {} | 108 ~StoredDataInfo(); |
| 109 | |
| 110 ~StoredDataInfo() { | |
| 111 if (owns_medium) { | |
| 112 ReleaseStgMedium(medium); | |
| 113 delete medium; | |
| 114 } | |
| 115 if (downloader.get()) | |
| 116 downloader->Stop(); | |
| 117 } | |
| 118 }; | 109 }; |
| 119 | 110 |
| 120 typedef ScopedVector<StoredDataInfo> StoredData; | 111 typedef ScopedVector<StoredDataInfo> StoredData; |
| 121 StoredData contents_; | 112 StoredData contents_; |
| 122 | 113 |
| 123 base::win::ScopedComPtr<IDataObject> source_object_; | 114 base::win::ScopedComPtr<IDataObject> source_object_; |
| 124 | 115 |
| 125 bool is_aborting_; | 116 bool is_aborting_; |
| 126 bool in_drag_loop_; | 117 bool in_drag_loop_; |
| 127 bool in_async_mode_; | 118 bool in_async_mode_; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Drag image and offset data. Only used for Ash. | 189 // Drag image and offset data. Only used for Ash. |
| 199 gfx::ImageSkia drag_image_; | 190 gfx::ImageSkia drag_image_; |
| 200 gfx::Vector2d drag_image_offset_; | 191 gfx::Vector2d drag_image_offset_; |
| 201 | 192 |
| 202 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderWin); | 193 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderWin); |
| 203 }; | 194 }; |
| 204 | 195 |
| 205 } // namespace ui | 196 } // namespace ui |
| 206 | 197 |
| 207 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ | 198 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ |
| OLD | NEW |