| 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 8 | 8 |
| 9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "ui/gfx/image/image.h" | 52 #include "ui/gfx/image/image.h" |
| 53 #include "ui/gfx/rect.h" | 53 #include "ui/gfx/rect.h" |
| 54 | 54 |
| 55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
| 56 #include <shobjidl.h> | 56 #include <shobjidl.h> |
| 57 | 57 |
| 58 #include "base/win/windows_version.h" | 58 #include "base/win/windows_version.h" |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 #if defined(TOOLKIT_VIEWS) | 61 #if defined(TOOLKIT_VIEWS) |
| 62 #include "ui/base/dragdrop/drag_drop_types.h" |
| 62 #include "ui/base/dragdrop/drag_utils.h" | 63 #include "ui/base/dragdrop/drag_utils.h" |
| 63 #include "ui/base/dragdrop/os_exchange_data.h" | 64 #include "ui/base/dragdrop/os_exchange_data.h" |
| 64 #include "ui/base/dragdrop/drag_drop_types.h" | |
| 65 #include "ui/gfx/screen.h" | 65 #include "ui/gfx/screen.h" |
| 66 #include "ui/views/widget/widget.h" | 66 #include "ui/views/widget/widget.h" |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 #if defined(TOOLKIT_GTK) | 69 #if defined(TOOLKIT_GTK) |
| 70 #include "chrome/browser/ui/gtk/custom_drag.h" | 70 #include "chrome/browser/ui/gtk/custom_drag.h" |
| 71 #include "chrome/browser/ui/gtk/unity_service.h" | 71 #include "chrome/browser/ui/gtk/unity_service.h" |
| 72 #endif // defined(TOOLKIT_GTK) | 72 #endif // defined(TOOLKIT_GTK) |
| 73 | 73 |
| 74 #if defined(OS_WIN) && !defined(USE_AURA) | 74 #if defined(OS_WIN) && !defined(USE_AURA) |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 void DragDownload(const DownloadItem* download, | 380 void DragDownload(const DownloadItem* download, |
| 381 gfx::Image* icon, | 381 gfx::Image* icon, |
| 382 gfx::NativeView view) { | 382 gfx::NativeView view) { |
| 383 DCHECK(download); | 383 DCHECK(download); |
| 384 | 384 |
| 385 // Set up our OLE machinery | 385 // Set up our OLE machinery |
| 386 ui::OSExchangeData data; | 386 ui::OSExchangeData data; |
| 387 | 387 |
| 388 if (icon) { | 388 if (icon) { |
| 389 drag_utils::CreateDragImageForFile( | 389 drag_utils::CreateDragImageForFile( |
| 390 download->GetFileNameToReportUser(), icon->ToSkBitmap(), &data); | 390 download->GetFileNameToReportUser(), icon->ToImageSkia(), &data); |
| 391 } | 391 } |
| 392 | 392 |
| 393 const FilePath full_path = download->GetFullPath(); | 393 const FilePath full_path = download->GetFullPath(); |
| 394 data.SetFilename(full_path); | 394 data.SetFilename(full_path); |
| 395 | 395 |
| 396 std::string mime_type = download->GetMimeType(); | 396 std::string mime_type = download->GetMimeType(); |
| 397 if (mime_type.empty()) | 397 if (mime_type.empty()) |
| 398 net::GetMimeTypeFromFile(full_path, &mime_type); | 398 net::GetMimeTypeFromFile(full_path, &mime_type); |
| 399 | 399 |
| 400 // Add URL so that we can load supported files when dragged to WebContents. | 400 // Add URL so that we can load supported files when dragged to WebContents. |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 UMA_HISTOGRAM_ENUMERATION( | 656 UMA_HISTOGRAM_ENUMERATION( |
| 657 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); | 657 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void RecordDownloadSource(ChromeDownloadSource source) { | 660 void RecordDownloadSource(ChromeDownloadSource source) { |
| 661 UMA_HISTOGRAM_ENUMERATION( | 661 UMA_HISTOGRAM_ENUMERATION( |
| 662 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); | 662 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); |
| 663 } | 663 } |
| 664 | 664 |
| 665 } // namespace download_util | 665 } // namespace download_util |
| OLD | NEW |