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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 7834048: Preliminary work to allow Chrome to build with USE_AURA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
64 #if defined(TOOLKIT_USES_GTK) 64 #if defined(TOOLKIT_USES_GTK)
65 #if defined(TOOLKIT_VIEWS) 65 #if defined(TOOLKIT_VIEWS)
66 #include "ui/base/dragdrop/drag_drop_types.h" 66 #include "ui/base/dragdrop/drag_drop_types.h"
67 #include "views/widget/native_widget_gtk.h" 67 #include "views/widget/native_widget_gtk.h"
68 #elif defined(TOOLKIT_GTK) 68 #elif defined(TOOLKIT_GTK)
69 #include "chrome/browser/ui/gtk/custom_drag.h" 69 #include "chrome/browser/ui/gtk/custom_drag.h"
70 #include "chrome/browser/ui/gtk/unity_service.h" 70 #include "chrome/browser/ui/gtk/unity_service.h"
71 #endif // defined(TOOLKIT_GTK) 71 #endif // defined(TOOLKIT_GTK)
72 #endif // defined(TOOLKIT_USES_GTK) 72 #endif // defined(TOOLKIT_USES_GTK)
73 73
74 #if defined(OS_WIN) 74 #if defined(OS_WIN) && !defined(USE_AURA)
75 #include "base/win/scoped_comptr.h" 75 #include "base/win/scoped_comptr.h"
76 #include "chrome/browser/ui/browser_list.h" 76 #include "chrome/browser/ui/browser_list.h"
77 #include "chrome/browser/ui/views/frame/browser_view.h" 77 #include "chrome/browser/ui/views/frame/browser_view.h"
78 #include "ui/base/dragdrop/drag_source.h" 78 #include "ui/base/dragdrop/drag_source.h"
79 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 79 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
80 #endif 80 #endif
81 81
82 // TODO(phajdan.jr): Find some standard location for this, maintaining 82 // TODO(phajdan.jr): Find some standard location for this, maintaining
83 // the same value on all platforms. 83 // the same value on all platforms.
84 static const double PI = 3.141592653589793; 84 static const double PI = 3.141592653589793;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 std::string mime_type = download->mime_type(); 384 std::string mime_type = download->mime_type();
385 if (mime_type.empty()) 385 if (mime_type.empty())
386 net::GetMimeTypeFromFile(full_path, &mime_type); 386 net::GetMimeTypeFromFile(full_path, &mime_type);
387 387
388 // Add URL so that we can load supported files when dragged to TabContents. 388 // Add URL so that we can load supported files when dragged to TabContents.
389 if (net::IsSupportedMimeType(mime_type)) { 389 if (net::IsSupportedMimeType(mime_type)) {
390 data.SetURL(net::FilePathToFileURL(full_path), 390 data.SetURL(net::FilePathToFileURL(full_path),
391 download->GetFileNameToReportUser().LossyDisplayName()); 391 download->GetFileNameToReportUser().LossyDisplayName());
392 } 392 }
393 393
394 #if defined(OS_WIN) 394 #if defined(USE_AURA)
395 // TODO(beng):
396 NOTIMPLEMENTED();
397 #elif defined(OS_WIN)
395 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); 398 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource);
396 399
397 // Run the drag and drop loop 400 // Run the drag and drop loop
398 DWORD effects; 401 DWORD effects;
399 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), 402 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data),
400 drag_source.get(), DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); 403 drag_source.get(), DROPEFFECT_COPY | DROPEFFECT_LINK, &effects);
401 #elif defined(TOOLKIT_USES_GTK) 404 #elif defined(TOOLKIT_USES_GTK)
402 GtkWidget* root = gtk_widget_get_toplevel(view); 405 GtkWidget* root = gtk_widget_get_toplevel(view);
403 if (!root) 406 if (!root)
404 return; 407 return;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, speed_text, amount); 535 IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, speed_text, amount);
533 } 536 }
534 return l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, 537 return l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_STATUS,
535 speed_text, amount, time_remaining); 538 speed_text, amount, time_remaining);
536 } 539 }
537 540
538 #if !defined(OS_MACOSX) 541 #if !defined(OS_MACOSX)
539 void UpdateAppIconDownloadProgress(int download_count, 542 void UpdateAppIconDownloadProgress(int download_count,
540 bool progress_known, 543 bool progress_known,
541 float progress) { 544 float progress) {
542 #if defined(OS_WIN) 545 #if defined(USE_AURA)
546 // TODO(beng):
547 NOTIMPLEMENTED();
548 #elif defined(OS_WIN)
543 // Taskbar progress bar is only supported on Win7. 549 // Taskbar progress bar is only supported on Win7.
544 if (base::win::GetVersion() < base::win::VERSION_WIN7) 550 if (base::win::GetVersion() < base::win::VERSION_WIN7)
545 return; 551 return;
546 552
547 base::win::ScopedComPtr<ITaskbarList3> taskbar; 553 base::win::ScopedComPtr<ITaskbarList3> taskbar;
548 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, 554 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL,
549 CLSCTX_INPROC_SERVER); 555 CLSCTX_INPROC_SERVER);
550 if (FAILED(result)) { 556 if (FAILED(result)) {
551 VLOG(1) << "Failed creating a TaskbarList object: " << result; 557 VLOG(1) << "Failed creating a TaskbarList object: " << result;
552 return; 558 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return DownloadFile::GetUniquePathNumberWithSuffix( 590 return DownloadFile::GetUniquePathNumberWithSuffix(
585 path, FILE_PATH_LITERAL(".crdownload")); 591 path, FILE_PATH_LITERAL(".crdownload"));
586 } 592 }
587 593
588 FilePath GetCrDownloadPath(const FilePath& suggested_path) { 594 FilePath GetCrDownloadPath(const FilePath& suggested_path) {
589 return DownloadFile::AppendSuffixToPath( 595 return DownloadFile::AppendSuffixToPath(
590 suggested_path, FILE_PATH_LITERAL(".crdownload")); 596 suggested_path, FILE_PATH_LITERAL(".crdownload"));
591 } 597 }
592 598
593 } // namespace download_util 599 } // namespace download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698