| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { | 186 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { |
| 187 // If a DownloadManager was set for this, Shutdown() must be called. | 187 // If a DownloadManager was set for this, Shutdown() must be called. |
| 188 DCHECK(!download_manager_); | 188 DCHECK(!download_manager_); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { | 191 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { |
| 192 download_manager_ = dm; | 192 download_manager_ = dm; |
| 193 | 193 |
| 194 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | 194 safe_browsing::SafeBrowsingService* sb_service = |
| 195 g_browser_process->safe_browsing_service(); |
| 195 if (sb_service && !profile_->IsOffTheRecord()) { | 196 if (sb_service && !profile_->IsOffTheRecord()) { |
| 196 // Include this download manager in the set monitored by safe browsing. | 197 // Include this download manager in the set monitored by safe browsing. |
| 197 sb_service->AddDownloadManager(dm); | 198 sb_service->AddDownloadManager(dm); |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 201 void ChromeDownloadManagerDelegate::Shutdown() { | 202 void ChromeDownloadManagerDelegate::Shutdown() { |
| 202 download_prefs_.reset(); | 203 download_prefs_.reset(); |
| 203 weak_ptr_factory_.InvalidateWeakPtrs(); | 204 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 204 download_manager_ = NULL; | 205 download_manager_ = NULL; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 510 |
| 510 std::string | 511 std::string |
| 511 ChromeDownloadManagerDelegate::ApplicationClientIdForFileScanning() const { | 512 ChromeDownloadManagerDelegate::ApplicationClientIdForFileScanning() const { |
| 512 return std::string(chrome::kApplicationClientIDStringForAVScanning); | 513 return std::string(chrome::kApplicationClientIDStringForAVScanning); |
| 513 } | 514 } |
| 514 | 515 |
| 515 DownloadProtectionService* | 516 DownloadProtectionService* |
| 516 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { | 517 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { |
| 517 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 518 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 518 #if defined(FULL_SAFE_BROWSING) | 519 #if defined(FULL_SAFE_BROWSING) |
| 519 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | 520 safe_browsing::SafeBrowsingService* sb_service = |
| 521 g_browser_process->safe_browsing_service(); |
| 520 if (sb_service && sb_service->download_protection_service() && | 522 if (sb_service && sb_service->download_protection_service() && |
| 521 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { | 523 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { |
| 522 return sb_service->download_protection_service(); | 524 return sb_service->download_protection_service(); |
| 523 } | 525 } |
| 524 #endif | 526 #endif |
| 525 return NULL; | 527 return NULL; |
| 526 } | 528 } |
| 527 | 529 |
| 528 void ChromeDownloadManagerDelegate::NotifyExtensions( | 530 void ChromeDownloadManagerDelegate::NotifyExtensions( |
| 529 DownloadItem* download, | 531 DownloadItem* download, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 752 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 751 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 753 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 752 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 754 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 753 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 755 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 754 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 756 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 755 return true; | 757 return true; |
| 756 } | 758 } |
| 757 #endif | 759 #endif |
| 758 return false; | 760 return false; |
| 759 } | 761 } |
| OLD | NEW |