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

Side by Side Diff: chrome/browser/download/download_prefs.h

Issue 1165893004: [Downloads] Prevent dangerous files from being opened automatically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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
OLDNEW
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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 bool IsDownloadPathManaged() const; 59 bool IsDownloadPathManaged() const;
60 60
61 // Returns true if there is at least one file extension registered 61 // Returns true if there is at least one file extension registered
62 // for auto-open. 62 // for auto-open.
63 bool IsAutoOpenUsed() const; 63 bool IsAutoOpenUsed() const;
64 64
65 // Returns true if |path| should be opened automatically based on 65 // Returns true if |path| should be opened automatically based on
66 // |path.Extension()|. 66 // |path.Extension()|.
67 bool IsAutoOpenEnabledBasedOnExtension(const base::FilePath& path) const; 67 bool IsAutoOpenEnabledBasedOnExtension(const base::FilePath& path) const;
68 68
69 // Enables auto-open based on file extension. Returns true on success. 69 // Enables automatically opening all downloads with the same file type as
70 // TODO(phajdan.jr): Add WARN_UNUSED_RESULT here. 70 // |file_name|. Returns true on success. The call may fail if |file_name|
71 // either doesn't have an extension (hence the file type cannot be
72 // determined), or if the file type is one that is disallowed from being
73 // opened automatically. See IsAllowedToOpenAutomatically() for details on the
74 // latter.
71 bool EnableAutoOpenBasedOnExtension(const base::FilePath& file_name); 75 bool EnableAutoOpenBasedOnExtension(const base::FilePath& file_name);
72 76
73 // Disables auto-open based on file extension. 77 // Disables auto-open based on file extension.
74 void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name); 78 void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name);
75 79
76 #if defined(OS_WIN) || defined(OS_LINUX) || \ 80 #if defined(OS_WIN) || defined(OS_LINUX) || \
77 (defined(OS_MACOSX) && !defined(OS_IOS)) 81 (defined(OS_MACOSX) && !defined(OS_IOS))
78 // Store the user preference to disk. If |should_open| is true, also disable 82 // Store the user preference to disk. If |should_open| is true, also disable
79 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin. 83 // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin.
80 void SetShouldOpenPdfInSystemReader(bool should_open); 84 void SetShouldOpenPdfInSystemReader(bool should_open);
(...skipping 26 matching lines...) Expand all
107 111
108 #if defined(OS_WIN) || defined(OS_LINUX) || \ 112 #if defined(OS_WIN) || defined(OS_LINUX) || \
109 (defined(OS_MACOSX) && !defined(OS_IOS)) 113 (defined(OS_MACOSX) && !defined(OS_IOS))
110 bool should_open_pdf_in_system_reader_; 114 bool should_open_pdf_in_system_reader_;
111 #endif 115 #endif
112 116
113 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); 117 DISALLOW_COPY_AND_ASSIGN(DownloadPrefs);
114 }; 118 };
115 119
116 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ 120 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_extensions.cc ('k') | chrome/browser/download/download_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698