OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifdef OS_WIN | 7 #ifdef OS_WIN |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 bool PathService::Get(int key, std::wstring* result) { | 208 bool PathService::Get(int key, std::wstring* result) { |
209 // Deprecated compatibility function. | 209 // Deprecated compatibility function. |
210 FilePath path; | 210 FilePath path; |
211 if (!Get(key, &path)) | 211 if (!Get(key, &path)) |
212 return false; | 212 return false; |
213 *result = path.ToWStringHack(); | 213 *result = path.ToWStringHack(); |
214 return true; | 214 return true; |
215 } | 215 } |
216 #endif | 216 #endif |
217 | 217 |
| 218 // TODO(evan): remove me -- see comments in header. |
| 219 bool PathService::IsOverridden(int key) { |
| 220 PathData* path_data = GetPathData(); |
| 221 DCHECK(path_data); |
| 222 AutoLock scoped_lock(path_data->lock); |
| 223 return path_data->overrides.find(key) != path_data->overrides.end(); |
| 224 } |
| 225 |
218 bool PathService::Override(int key, const FilePath& path) { | 226 bool PathService::Override(int key, const FilePath& path) { |
219 PathData* path_data = GetPathData(); | 227 PathData* path_data = GetPathData(); |
220 DCHECK(path_data); | 228 DCHECK(path_data); |
221 DCHECK(key > base::DIR_CURRENT) << "invalid path key"; | 229 DCHECK(key > base::DIR_CURRENT) << "invalid path key"; |
222 | 230 |
223 FilePath file_path = path; | 231 FilePath file_path = path; |
224 | 232 |
225 // Make sure the directory exists. We need to do this before we translate | 233 // Make sure the directory exists. We need to do this before we translate |
226 // this to the absolute path because on POSIX, AbsolutePath fails if called | 234 // this to the absolute path because on POSIX, AbsolutePath fails if called |
227 // on a non-existant path. | 235 // on a non-existant path. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 p = new Provider; | 277 p = new Provider; |
270 p->is_static = false; | 278 p->is_static = false; |
271 p->func = func; | 279 p->func = func; |
272 p->next = path_data->providers; | 280 p->next = path_data->providers; |
273 #ifndef NDEBUG | 281 #ifndef NDEBUG |
274 p->key_start = key_start; | 282 p->key_start = key_start; |
275 p->key_end = key_end; | 283 p->key_end = key_end; |
276 #endif | 284 #endif |
277 path_data->providers = p; | 285 path_data->providers = p; |
278 } | 286 } |
OLD | NEW |