| 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 #ifndef BASE_PATH_SERVICE_H__ | 5 #ifndef BASE_PATH_SERVICE_H__ |
| 6 #define BASE_PATH_SERVICE_H__ | 6 #define BASE_PATH_SERVICE_H__ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #ifdef OS_WIN | 9 #ifdef OS_WIN |
| 10 // TODO(erikkay): this should be removable, but because SetCurrentDirectory | 10 // TODO(erikkay): this should be removable, but because SetCurrentDirectory |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 static bool SetCurrentDirectory(const std::wstring& current_directory); | 56 static bool SetCurrentDirectory(const std::wstring& current_directory); |
| 57 | 57 |
| 58 // To extend the set of supported keys, you can register a path provider, | 58 // To extend the set of supported keys, you can register a path provider, |
| 59 // which is just a function mirroring PathService::Get. The ProviderFunc | 59 // which is just a function mirroring PathService::Get. The ProviderFunc |
| 60 // returns false if it cannot provide a non-empty path for the given key. | 60 // returns false if it cannot provide a non-empty path for the given key. |
| 61 // Otherwise, true is returned. | 61 // Otherwise, true is returned. |
| 62 // | 62 // |
| 63 // WARNING: This function could be called on any thread from which the | 63 // WARNING: This function could be called on any thread from which the |
| 64 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE. | 64 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE. |
| 65 // | 65 // |
| 66 typedef bool (*ProviderFunc)(int, std::wstring*); | 66 typedef bool (*ProviderFunc)(int, FilePath*); |
| 67 | 67 |
| 68 // Call to register a path provider. You must specify the range "[key_start, | 68 // Call to register a path provider. You must specify the range "[key_start, |
| 69 // key_end)" of supported path keys. | 69 // key_end)" of supported path keys. |
| 70 static void RegisterProvider(ProviderFunc provider, | 70 static void RegisterProvider(ProviderFunc provider, |
| 71 int key_start, | 71 int key_start, |
| 72 int key_end); | 72 int key_end); |
| 73 private: | 73 private: |
| 74 static bool GetFromCache(int key, FilePath* path); | 74 static bool GetFromCache(int key, FilePath* path); |
| 75 static void AddToCache(int key, const FilePath& path); | 75 static void AddToCache(int key, const FilePath& path); |
| 76 | 76 |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #endif // BASE_PATH_SERVICE_H__ | 79 #endif // BASE_PATH_SERVICE_H__ |
| 80 | 80 |
| OLD | NEW |