| 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_prefs.h" | 5 #include "chrome/browser/download/download_prefs.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 using content::BrowserContext; | 39 using content::BrowserContext; |
| 40 using content::BrowserThread; | 40 using content::BrowserThread; |
| 41 using content::DownloadManager; | 41 using content::DownloadManager; |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 // Consider downloads 'dangerous' if they go to the home directory on Linux and | 45 // Consider downloads 'dangerous' if they go to the home directory on Linux and |
| 46 // to the desktop on any platform. | 46 // to the desktop on any platform. |
| 47 bool DownloadPathIsDangerous(const base::FilePath& download_path) { | 47 bool DownloadPathIsDangerous(const base::FilePath& download_path) { |
| 48 #if defined(OS_LINUX) | 48 #if defined(OS_LINUX) |
| 49 base::FilePath home_dir = file_util::GetHomeDir(); | 49 base::FilePath home_dir = base::GetHomeDir(); |
| 50 if (download_path == home_dir) { | 50 if (download_path == home_dir) { |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
| 56 // Android does not have a desktop dir. | 56 // Android does not have a desktop dir. |
| 57 return false; | 57 return false; |
| 58 #else | 58 #else |
| 59 base::FilePath desktop_dir; | 59 base::FilePath desktop_dir; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 extensions.erase(extensions.size() - 1); | 299 extensions.erase(extensions.size() - 1); |
| 300 | 300 |
| 301 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 301 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 304 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
| 305 const base::FilePath::StringType& a, | 305 const base::FilePath::StringType& a, |
| 306 const base::FilePath::StringType& b) const { | 306 const base::FilePath::StringType& b) const { |
| 307 return base::FilePath::CompareLessIgnoreCase(a, b); | 307 return base::FilePath::CompareLessIgnoreCase(a, b); |
| 308 } | 308 } |
| OLD | NEW |