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 | |
226 bool PathService::Override(int key, const FilePath& path) { | 218 bool PathService::Override(int key, const FilePath& path) { |
227 PathData* path_data = GetPathData(); | 219 PathData* path_data = GetPathData(); |
228 DCHECK(path_data); | 220 DCHECK(path_data); |
229 DCHECK(key > base::DIR_CURRENT) << "invalid path key"; | 221 DCHECK(key > base::DIR_CURRENT) << "invalid path key"; |
230 | 222 |
231 FilePath file_path = path; | 223 FilePath file_path = path; |
232 | 224 |
233 // Make sure the directory exists. We need to do this before we translate | 225 // Make sure the directory exists. We need to do this before we translate |
234 // this to the absolute path because on POSIX, AbsolutePath fails if called | 226 // this to the absolute path because on POSIX, AbsolutePath fails if called |
235 // on a non-existant path. | 227 // on a non-existant path. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 p = new Provider; | 269 p = new Provider; |
278 p->is_static = false; | 270 p->is_static = false; |
279 p->func = func; | 271 p->func = func; |
280 p->next = path_data->providers; | 272 p->next = path_data->providers; |
281 #ifndef NDEBUG | 273 #ifndef NDEBUG |
282 p->key_start = key_start; | 274 p->key_start = key_start; |
283 p->key_end = key_end; | 275 p->key_end = key_end; |
284 #endif | 276 #endif |
285 path_data->providers = p; | 277 path_data->providers = p; |
286 } | 278 } |
OLD | NEW |