| 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 "base/path_service.h" | 5 #include "base/path_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return (result && | 55 return (result && |
| 56 ::GetDefaultUserProfileDirectory(default_profile_path, &size) && | 56 ::GetDefaultUserProfileDirectory(default_profile_path, &size) && |
| 57 StartsWith(path.value(), default_profile_path, false)); | 57 StartsWith(path.value(), default_profile_path, false)); |
| 58 } | 58 } |
| 59 } else if (dir_type == base::DIR_TASKBAR_PINS) { | 59 } else if (dir_type == base::DIR_TASKBAR_PINS) { |
| 60 // There is no pinned-to-taskbar shortcuts prior to Win7. | 60 // There is no pinned-to-taskbar shortcuts prior to Win7. |
| 61 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 61 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 62 check_path_exists = false; | 62 check_path_exists = false; |
| 63 } | 63 } |
| 64 #endif | 64 #endif |
| 65 #if defined(OS_MAC) | 65 #if defined(OS_MACOSX) |
| 66 if (dir_type != base::DIR_EXE && dir_type != base::DIR_MODULE && | 66 if (dir_type != base::DIR_EXE && dir_type != base::DIR_MODULE && |
| 67 dir_type != base::FILE_EXE && dir_type != base::FILE_MODULE) { | 67 dir_type != base::FILE_EXE && dir_type != base::FILE_MODULE) { |
| 68 if (path.ReferencesParent()) | 68 if (path.ReferencesParent()) |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 #else | 71 #else |
| 72 if (path.ReferencesParent()) | 72 if (path.ReferencesParent()) |
| 73 return false; | 73 return false; |
| 74 #endif | 74 #endif |
| 75 return result && !path.empty() && (!check_path_exists || | 75 return result && !path.empty() && (!check_path_exists || |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 207 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 208 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path())); | 208 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path())); |
| 209 base::FilePath new_user_data_dir; | 209 base::FilePath new_user_data_dir; |
| 210 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); | 210 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); |
| 211 EXPECT_NE(original_user_data_dir, new_user_data_dir); | 211 EXPECT_NE(original_user_data_dir, new_user_data_dir); |
| 212 | 212 |
| 213 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP)); | 213 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP)); |
| 214 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); | 214 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); |
| 215 EXPECT_EQ(original_user_data_dir, new_user_data_dir); | 215 EXPECT_EQ(original_user_data_dir, new_user_data_dir); |
| 216 } | 216 } |
| OLD | NEW |