| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 return (download_path == desktop_dir); | 75 return (download_path == desktop_dir); |
| 76 #endif | 76 #endif |
| 77 } | 77 } |
| 78 | 78 |
| 79 class DefaultDownloadDirectory { | 79 class DefaultDownloadDirectory { |
| 80 public: | 80 public: |
| 81 const base::FilePath& path() const { return path_; } | 81 const base::FilePath& path() const { return path_; } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 friend struct base::DefaultLazyInstanceTraits<DefaultDownloadDirectory>; | 84 friend struct base::LazyInstanceTraitsBase<DefaultDownloadDirectory>; |
| 85 | 85 |
| 86 DefaultDownloadDirectory() { | 86 DefaultDownloadDirectory() { |
| 87 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &path_)) { | 87 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &path_)) { |
| 88 NOTREACHED(); | 88 NOTREACHED(); |
| 89 } | 89 } |
| 90 if (DownloadPathIsDangerous(path_)) { | 90 if (DownloadPathIsDangerous(path_)) { |
| 91 // This is only useful on platforms that support | 91 // This is only useful on platforms that support |
| 92 // DIR_DEFAULT_DOWNLOADS_SAFE. | 92 // DIR_DEFAULT_DOWNLOADS_SAFE. |
| 93 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &path_)) { | 93 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &path_)) { |
| 94 NOTREACHED(); | 94 NOTREACHED(); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 extensions.erase(extensions.size() - 1); | 382 extensions.erase(extensions.size() - 1); |
| 383 | 383 |
| 384 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 384 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
| 385 } | 385 } |
| 386 | 386 |
| 387 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 387 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
| 388 const base::FilePath::StringType& a, | 388 const base::FilePath::StringType& a, |
| 389 const base::FilePath::StringType& b) const { | 389 const base::FilePath::StringType& b) const { |
| 390 return base::FilePath::CompareLessIgnoreCase(a, b); | 390 return base::FilePath::CompareLessIgnoreCase(a, b); |
| 391 } | 391 } |
| OLD | NEW |