| 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/download_service.h" | 5 #include "chrome/browser/download/download_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 9 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 10 #include "chrome/browser/download/download_history.h" | 10 #include "chrome/browser/download/download_history.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // If we've already created the delegate, just return it. | 35 // If we've already created the delegate, just return it. |
| 36 if (download_manager_created_) { | 36 if (download_manager_created_) { |
| 37 DCHECK(static_cast<DownloadManagerDelegate*>(manager_delegate_.get()) == | 37 DCHECK(static_cast<DownloadManagerDelegate*>(manager_delegate_.get()) == |
| 38 manager->GetDelegate()); | 38 manager->GetDelegate()); |
| 39 return manager_delegate_.get(); | 39 return manager_delegate_.get(); |
| 40 } | 40 } |
| 41 download_manager_created_ = true; | 41 download_manager_created_ = true; |
| 42 | 42 |
| 43 // In case the delegate has already been set by | 43 // In case the delegate has already been set by |
| 44 // SetDownloadManagerDelegateForTesting. | 44 // SetDownloadManagerDelegateForTesting. |
| 45 if (!manager_delegate_) | 45 if (!manager_delegate_.get()) |
| 46 manager_delegate_ = new ChromeDownloadManagerDelegate(profile_); | 46 manager_delegate_ = new ChromeDownloadManagerDelegate(profile_); |
| 47 | 47 |
| 48 manager_delegate_->SetDownloadManager(manager); | 48 manager_delegate_->SetDownloadManager(manager); |
| 49 | 49 |
| 50 #if !defined(OS_ANDROID) | 50 #if !defined(OS_ANDROID) |
| 51 extension_event_router_.reset(new ExtensionDownloadsEventRouter( | 51 extension_event_router_.reset(new ExtensionDownloadsEventRouter( |
| 52 profile_, manager)); | 52 profile_, manager)); |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 if (!profile_->IsOffTheRecord()) { | 55 if (!profile_->IsOffTheRecord()) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // code) when the DownloadManager is shutting down. So we shut it down | 132 // code) when the DownloadManager is shutting down. So we shut it down |
| 133 // manually earlier. See http://crbug.com/131692 | 133 // manually earlier. See http://crbug.com/131692 |
| 134 BrowserContext::GetDownloadManager(profile_)->Shutdown(); | 134 BrowserContext::GetDownloadManager(profile_)->Shutdown(); |
| 135 } | 135 } |
| 136 #if !defined(OS_ANDROID) | 136 #if !defined(OS_ANDROID) |
| 137 extension_event_router_.reset(); | 137 extension_event_router_.reset(); |
| 138 #endif | 138 #endif |
| 139 manager_delegate_ = NULL; | 139 manager_delegate_ = NULL; |
| 140 download_history_.reset(); | 140 download_history_.reset(); |
| 141 } | 141 } |
| OLD | NEW |