| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (!file_util::PathExists(file_path) && | 224 if (!file_util::PathExists(file_path) && |
| 225 !file_util::CreateDirectory(file_path)) | 225 !file_util::CreateDirectory(file_path)) |
| 226 return false; | 226 return false; |
| 227 | 227 |
| 228 AutoLock scoped_lock(path_data->lock); | 228 AutoLock scoped_lock(path_data->lock); |
| 229 path_data->cache[key] = file_path; | 229 path_data->cache[key] = file_path; |
| 230 path_data->overrides.insert(key); | 230 path_data->overrides.insert(key); |
| 231 return true; | 231 return true; |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool PathService::Override(int key, const std::wstring& path) { | |
| 235 return Override(key, FilePath::FromWStringHack(path)); | |
| 236 } | |
| 237 | |
| 238 bool PathService::SetCurrentDirectory(const std::wstring& current_directory) { | 234 bool PathService::SetCurrentDirectory(const std::wstring& current_directory) { |
| 239 return file_util::SetCurrentDirectory(current_directory); | 235 return file_util::SetCurrentDirectory(current_directory); |
| 240 } | 236 } |
| 241 | 237 |
| 242 void PathService::RegisterProvider(ProviderFunc func, int key_start, | 238 void PathService::RegisterProvider(ProviderFunc func, int key_start, |
| 243 int key_end) { | 239 int key_end) { |
| 244 PathData* path_data = GetPathData(); | 240 PathData* path_data = GetPathData(); |
| 245 DCHECK(path_data); | 241 DCHECK(path_data); |
| 246 DCHECK(key_end > key_start); | 242 DCHECK(key_end > key_start); |
| 247 | 243 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 261 p = new Provider; | 257 p = new Provider; |
| 262 p->is_static = false; | 258 p->is_static = false; |
| 263 p->func = func; | 259 p->func = func; |
| 264 p->next = path_data->providers; | 260 p->next = path_data->providers; |
| 265 #ifndef NDEBUG | 261 #ifndef NDEBUG |
| 266 p->key_start = key_start; | 262 p->key_start = key_start; |
| 267 p->key_end = key_end; | 263 p->key_end = key_end; |
| 268 #endif | 264 #endif |
| 269 path_data->providers = p; | 265 path_data->providers = p; |
| 270 } | 266 } |
| OLD | NEW |