| 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 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return DownloadId(this, next_download_id_++); | 186 return DownloadId(this, next_download_id_++); |
| 187 | 187 |
| 188 return BrowserContext::GetDownloadManager(profile_->GetOriginalProfile())-> | 188 return BrowserContext::GetDownloadManager(profile_->GetOriginalProfile())-> |
| 189 GetDelegate()->GetNextId(); | 189 GetDelegate()->GetNextId(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool ChromeDownloadManagerDelegate::DetermineDownloadTarget( | 192 bool ChromeDownloadManagerDelegate::DetermineDownloadTarget( |
| 193 DownloadItem* download, | 193 DownloadItem* download, |
| 194 const content::DownloadTargetCallback& callback) { | 194 const content::DownloadTargetCallback& callback) { |
| 195 DownloadTargetDeterminer::Start(download, | 195 DownloadTargetDeterminer::Start(download, |
| 196 GetPlatformDownloadPath(profile_, download), |
| 196 download_prefs_.get(), | 197 download_prefs_.get(), |
| 197 last_download_path_, | 198 last_download_path_, |
| 198 this, | 199 this, |
| 199 callback); | 200 callback); |
| 200 return true; | 201 return true; |
| 201 } | 202 } |
| 202 | 203 |
| 203 bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( | 204 bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( |
| 204 const base::FilePath& path) { | 205 const base::FilePath& path) { |
| 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 registrar_.Remove(this, | 571 registrar_.Remove(this, |
| 571 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 572 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 572 source); | 573 source); |
| 573 | 574 |
| 574 scoped_refptr<extensions::CrxInstaller> installer = | 575 scoped_refptr<extensions::CrxInstaller> installer = |
| 575 content::Source<extensions::CrxInstaller>(source).ptr(); | 576 content::Source<extensions::CrxInstaller>(source).ptr(); |
| 576 content::DownloadOpenDelayedCallback callback = crx_installers_[installer]; | 577 content::DownloadOpenDelayedCallback callback = crx_installers_[installer]; |
| 577 crx_installers_.erase(installer.get()); | 578 crx_installers_.erase(installer.get()); |
| 578 callback.Run(installer->did_handle_successfully()); | 579 callback.Run(installer->did_handle_successfully()); |
| 579 } | 580 } |
| OLD | NEW |