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

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

Issue 1403001: Modifying the "dangerous download" algorithm. (Closed)
Patch Set: Adding .sys and .drv as Dangerous extensions Created 10 years 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
« no previous file with comments | « chrome/browser/download/download_item.cc ('k') | chrome/browser/download/download_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/rand_util.h" 13 #include "base/rand_util.h"
14 #include "base/stl_util-inl.h" 14 #include "base/stl_util-inl.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/sys_string_conversions.h" 16 #include "base/sys_string_conversions.h"
17 #include "base/task.h" 17 #include "base/task.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/browser_list.h" 20 #include "chrome/browser/browser_list.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/browser_thread.h" 22 #include "chrome/browser/browser_thread.h"
23 #include "chrome/browser/download/download_extensions.h"
23 #include "chrome/browser/download/download_file_manager.h" 24 #include "chrome/browser/download/download_file_manager.h"
24 #include "chrome/browser/download/download_history.h" 25 #include "chrome/browser/download/download_history.h"
25 #include "chrome/browser/download/download_item.h" 26 #include "chrome/browser/download/download_item.h"
26 #include "chrome/browser/download/download_prefs.h" 27 #include "chrome/browser/download/download_prefs.h"
27 #include "chrome/browser/download/download_status_updater.h" 28 #include "chrome/browser/download/download_status_updater.h"
28 #include "chrome/browser/download/download_util.h" 29 #include "chrome/browser/download/download_util.h"
29 #include "chrome/browser/extensions/extensions_service.h" 30 #include "chrome/browser/extensions/extensions_service.h"
30 #include "chrome/browser/history/download_create_info.h" 31 #include "chrome/browser/history/download_create_info.h"
31 #include "chrome/browser/net/chrome_url_request_context.h" 32 #include "chrome/browser/net/chrome_url_request_context.h"
32 #include "chrome/browser/platform_util.h" 33 #include "chrome/browser/platform_util.h"
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 830
830 void DownloadManager::RemoveObserver(Observer* observer) { 831 void DownloadManager::RemoveObserver(Observer* observer) {
831 observers_.RemoveObserver(observer); 832 observers_.RemoveObserver(observer);
832 } 833 }
833 834
834 bool DownloadManager::ShouldOpenFileBasedOnExtension( 835 bool DownloadManager::ShouldOpenFileBasedOnExtension(
835 const FilePath& path) const { 836 const FilePath& path) const {
836 FilePath::StringType extension = path.Extension(); 837 FilePath::StringType extension = path.Extension();
837 if (extension.empty()) 838 if (extension.empty())
838 return false; 839 return false;
839 if (download_util::IsExecutableExtension(extension)) 840 if (!download_util::IsFileExtensionSafe(extension))
840 return false; 841 return false;
841 if (Extension::IsExtension(path)) 842 if (Extension::IsExtension(path))
842 return false; 843 return false;
843 DCHECK(extension[0] == FilePath::kExtensionSeparator); 844 DCHECK(extension[0] == FilePath::kExtensionSeparator);
844 extension.erase(0, 1); 845 extension.erase(0, 1);
845 return download_prefs_->IsAutoOpenEnabledForExtension(extension); 846 return download_prefs_->IsAutoOpenEnabledForExtension(extension);
846 } 847 }
847 848
848 bool DownloadManager::IsDownloadProgressKnown() { 849 bool DownloadManager::IsDownloadProgressKnown() {
849 for (DownloadMap::iterator i = in_progress_.begin(); 850 for (DownloadMap::iterator i = in_progress_.begin();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 observed_download_manager_->RemoveObserver(this); 1040 observed_download_manager_->RemoveObserver(this);
1040 } 1041 }
1041 1042
1042 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1043 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1043 observing_download_manager_->NotifyModelChanged(); 1044 observing_download_manager_->NotifyModelChanged();
1044 } 1045 }
1045 1046
1046 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1047 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1047 observed_download_manager_ = NULL; 1048 observed_download_manager_ = NULL;
1048 } 1049 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item.cc ('k') | chrome/browser/download/download_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698