| 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 #include "chrome/browser/download/download_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 platform_util::ShowItemInFolder(download->full_path()); | 913 platform_util::ShowItemInFolder(download->full_path()); |
| 914 #else | 914 #else |
| 915 ChromeThread::PostTask( | 915 ChromeThread::PostTask( |
| 916 ChromeThread::FILE, FROM_HERE, | 916 ChromeThread::FILE, FROM_HERE, |
| 917 NewRunnableMethod( | 917 NewRunnableMethod( |
| 918 file_manager_, &DownloadFileManager::OnShowDownloadInShell, | 918 file_manager_, &DownloadFileManager::OnShowDownloadInShell, |
| 919 FilePath(download->full_path()))); | 919 FilePath(download->full_path()))); |
| 920 #endif | 920 #endif |
| 921 } | 921 } |
| 922 | 922 |
| 923 void DownloadManager::OpenDownload(const DownloadItem* download, | 923 void DownloadManager::OpenDownload(DownloadItem* download, |
| 924 gfx::NativeView parent_window) { | 924 gfx::NativeView parent_window) { |
| 925 // Open Chrome extensions with ExtensionsService. For everything else do shell | 925 // Open Chrome extensions with ExtensionsService. For everything else do shell |
| 926 // execute. | 926 // execute. |
| 927 if (download->is_extension_install()) { | 927 if (download->is_extension_install()) { |
| 928 download->Opened(); |
| 928 download_util::OpenChromeExtension(profile_, this, *download); | 929 download_util::OpenChromeExtension(profile_, this, *download); |
| 929 } else { | 930 } else { |
| 930 OpenDownloadInShell(download, parent_window); | 931 OpenDownloadInShell(download, parent_window); |
| 931 } | 932 } |
| 932 } | 933 } |
| 933 | 934 |
| 934 void DownloadManager::OpenDownloadInShell(const DownloadItem* download, | 935 void DownloadManager::OpenDownloadInShell(DownloadItem* download, |
| 935 gfx::NativeView parent_window) { | 936 gfx::NativeView parent_window) { |
| 936 DCHECK(file_manager_); | 937 DCHECK(file_manager_); |
| 937 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 938 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 939 download->Opened(); |
| 938 #if defined(OS_MACOSX) | 940 #if defined(OS_MACOSX) |
| 939 // Mac OS X requires opening downloads on the UI thread. | 941 // Mac OS X requires opening downloads on the UI thread. |
| 940 platform_util::OpenItem(download->full_path()); | 942 platform_util::OpenItem(download->full_path()); |
| 941 #else | 943 #else |
| 942 ChromeThread::PostTask( | 944 ChromeThread::PostTask( |
| 943 ChromeThread::FILE, FROM_HERE, | 945 ChromeThread::FILE, FROM_HERE, |
| 944 NewRunnableMethod( | 946 NewRunnableMethod( |
| 945 file_manager_, &DownloadFileManager::OnOpenDownloadInShell, | 947 file_manager_, &DownloadFileManager::OnOpenDownloadInShell, |
| 946 download->full_path(), download->url(), parent_window)); | 948 download->full_path(), download->url(), parent_window)); |
| 947 #endif | 949 #endif |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 observed_download_manager_->RemoveObserver(this); | 1166 observed_download_manager_->RemoveObserver(this); |
| 1165 } | 1167 } |
| 1166 | 1168 |
| 1167 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { | 1169 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { |
| 1168 observing_download_manager_->NotifyModelChanged(); | 1170 observing_download_manager_->NotifyModelChanged(); |
| 1169 } | 1171 } |
| 1170 | 1172 |
| 1171 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { | 1173 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { |
| 1172 observed_download_manager_ = NULL; | 1174 observed_download_manager_ = NULL; |
| 1173 } | 1175 } |
| OLD | NEW |