| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 // TODO(brettw): this function does not handle long paths (filename > MAX_PATH) | 166 // TODO(brettw): this function does not handle long paths (filename > MAX_PATH) |
| 167 // characters). This isn't supported very well by Windows right now, so it is | 167 // characters). This isn't supported very well by Windows right now, so it is |
| 168 // moot, but we should keep this in mind for the future. | 168 // moot, but we should keep this in mind for the future. |
| 169 // static | 169 // static |
| 170 bool PathService::Get(int key, FilePath* result) { | 170 bool PathService::Get(int key, FilePath* result) { |
| 171 PathData* path_data = GetPathData(); | 171 PathData* path_data = GetPathData(); |
| 172 DCHECK(path_data); | 172 DCHECK(path_data); |
| 173 DCHECK(result); | 173 DCHECK(result); |
| 174 DCHECK(key >= base::DIR_CURRENT); | 174 DCHECK_GE(key, base::DIR_CURRENT); |
| 175 | 175 |
| 176 // special case the current directory because it can never be cached | 176 // special case the current directory because it can never be cached |
| 177 if (key == base::DIR_CURRENT) | 177 if (key == base::DIR_CURRENT) |
| 178 return file_util::GetCurrentDirectory(result); | 178 return file_util::GetCurrentDirectory(result); |
| 179 | 179 |
| 180 if (GetFromCache(key, result)) | 180 if (GetFromCache(key, result)) |
| 181 return true; | 181 return true; |
| 182 | 182 |
| 183 if (GetFromOverrides(key, result)) | 183 if (GetFromOverrides(key, result)) |
| 184 return true; | 184 return true; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 p = new Provider; | 259 p = new Provider; |
| 260 p->is_static = false; | 260 p->is_static = false; |
| 261 p->func = func; | 261 p->func = func; |
| 262 p->next = path_data->providers; | 262 p->next = path_data->providers; |
| 263 #ifndef NDEBUG | 263 #ifndef NDEBUG |
| 264 p->key_start = key_start; | 264 p->key_start = key_start; |
| 265 p->key_end = key_end; | 265 p->key_end = key_end; |
| 266 #endif | 266 #endif |
| 267 path_data->providers = p; | 267 path_data->providers = p; |
| 268 } | 268 } |
| OLD | NEW |