Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Side by Side Diff: base/path_service.cc

Issue 5123004: chrome_paths: refactor and sanitize cache directory handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/path_service.h ('k') | base/path_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « base/path_service.h ('k') | base/path_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698