summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-30 22:13:32 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-30 22:13:32 +0000
commitb99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8 (patch)
tree2f9074d5ad8acf95156fc9c390646eca935d232e /chrome/browser/download
parent004f2cf5d5eb19764260b1f513738be15ae77d47 (diff)
downloadchromium_src-b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8.zip
chromium_src-b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8.tar.gz
chromium_src-b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8.tar.bz2
Move some functions out of win_util and into hwnd_util, and into a new win/shell file.
This also moves two functions that were only called once from win_util and inwo window_win and download_util, respectively. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/6035011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r--chrome/browser/download/download_util.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 1854d11..92c24a3 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -92,6 +92,39 @@ static const int kCompleteAnimationCycles = 5;
// Also used by code that cleans up said files.
static const int kMaxUniqueFiles = 100;
+namespace {
+
+#if defined(OS_WIN)
+// Returns whether the specified extension is automatically integrated into the
+// windows shell.
+bool IsShellIntegratedExtension(const string16& extension) {
+ string16 extension_lower = StringToLowerASCII(extension);
+
+ static const wchar_t* const integrated_extensions[] = {
+ // See <http://msdn.microsoft.com/en-us/library/ms811694.aspx>.
+ L"local",
+ // Right-clicking on shortcuts can be magical.
+ L"lnk",
+ };
+
+ for (int i = 0; i < arraysize(integrated_extensions); ++i) {
+ if (extension_lower == integrated_extensions[i])
+ return true;
+ }
+
+ // See <http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html>.
+ // That vulnerability report is not exactly on point, but files become magical
+ // if their end in a CLSID. Here we block extensions that look like CLSIDs.
+ if (extension_lower.size() > 0 && extension_lower.at(0) == L'{' &&
+ extension_lower.at(extension_lower.length() - 1) == L'}')
+ return true;
+
+ return false;
+}
+#endif // OS_WIN
+
+} // namespace
+
// Download temporary file creation --------------------------------------------
class DefaultDownloadDirectory {
@@ -157,7 +190,7 @@ void GenerateExtension(const FilePath& file_name,
FILE_PATH_LITERAL("download");
// Rename shell-integrated extensions.
- if (win_util::IsShellIntegratedExtension(extension))
+ if (IsShellIntegratedExtension(extension))
extension.assign(default_extension);
#endif