| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "app/drag_drop_types.h" | 64 #include "app/drag_drop_types.h" |
| 65 #include "views/widget/widget_gtk.h" | 65 #include "views/widget/widget_gtk.h" |
| 66 #elif defined(TOOLKIT_GTK) | 66 #elif defined(TOOLKIT_GTK) |
| 67 #include "chrome/browser/gtk/custom_drag.h" | 67 #include "chrome/browser/gtk/custom_drag.h" |
| 68 #endif // defined(TOOLKIT_GTK) | 68 #endif // defined(TOOLKIT_GTK) |
| 69 #endif // defined(TOOLKIT_USES_GTK) | 69 #endif // defined(TOOLKIT_USES_GTK) |
| 70 | 70 |
| 71 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 72 #include "app/os_exchange_data_provider_win.h" | 72 #include "app/os_exchange_data_provider_win.h" |
| 73 #include "app/win_util.h" | 73 #include "app/win_util.h" |
| 74 #include "base/base_drag_source.h" | 74 #include "app/win/drag_source.h" |
| 75 #include "base/win/scoped_comptr.h" | 75 #include "base/win/scoped_comptr.h" |
| 76 #include "base/win_util.h" | 76 #include "base/win_util.h" |
| 77 #include "chrome/browser/browser_list.h" | 77 #include "chrome/browser/browser_list.h" |
| 78 #include "chrome/browser/views/frame/browser_view.h" | 78 #include "chrome/browser/views/frame/browser_view.h" |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 namespace download_util { | 81 namespace download_util { |
| 82 | 82 |
| 83 // How many times to cycle the complete animation. This should be an odd number | 83 // How many times to cycle the complete animation. This should be an odd number |
| 84 // so that the animation ends faded out. | 84 // so that the animation ends faded out. |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 if (mime_type.empty()) | 453 if (mime_type.empty()) |
| 454 net::GetMimeTypeFromFile(full_path, &mime_type); | 454 net::GetMimeTypeFromFile(full_path, &mime_type); |
| 455 | 455 |
| 456 // Add URL so that we can load supported files when dragged to TabContents. | 456 // Add URL so that we can load supported files when dragged to TabContents. |
| 457 if (net::IsSupportedMimeType(mime_type)) { | 457 if (net::IsSupportedMimeType(mime_type)) { |
| 458 data.SetURL(GURL(WideToUTF8(full_path.ToWStringHack())), | 458 data.SetURL(GURL(WideToUTF8(full_path.ToWStringHack())), |
| 459 download->GetFileName().ToWStringHack()); | 459 download->GetFileName().ToWStringHack()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 #if defined(OS_WIN) | 462 #if defined(OS_WIN) |
| 463 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); | 463 scoped_refptr<app::win::DragSource> drag_source(new app::win::DragSource); |
| 464 | 464 |
| 465 // Run the drag and drop loop | 465 // Run the drag and drop loop |
| 466 DWORD effects; | 466 DWORD effects; |
| 467 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source.get(), | 467 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source.get(), |
| 468 DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); | 468 DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); |
| 469 #elif defined(TOOLKIT_USES_GTK) | 469 #elif defined(TOOLKIT_USES_GTK) |
| 470 GtkWidget* root = gtk_widget_get_toplevel(view); | 470 GtkWidget* root = gtk_widget_get_toplevel(view); |
| 471 if (!root) | 471 if (!root) |
| 472 return; | 472 return; |
| 473 views::WidgetGtk* widget = views::WidgetGtk::GetViewForNative(root); | 473 views::WidgetGtk* widget = views::WidgetGtk::GetViewForNative(root); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 ExtensionsService* service = profile->GetExtensionsService(); | 725 ExtensionsService* service = profile->GetExtensionsService(); |
| 726 if (!service || | 726 if (!service || |
| 727 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { | 727 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { |
| 728 return true; | 728 return true; |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 return false; | 731 return false; |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace download_util | 734 } // namespace download_util |
| OLD | NEW |