| 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 30 matching lines...) Expand all Loading... |
| 41 // Overrides the path to a special directory or file. This cannot be used to | 41 // Overrides the path to a special directory or file. This cannot be used to |
| 42 // change the value of DIR_CURRENT, but that should be obvious. Also, if the | 42 // change the value of DIR_CURRENT, but that should be obvious. Also, if the |
| 43 // path specifies a directory that does not exist, the directory will be | 43 // path specifies a directory that does not exist, the directory will be |
| 44 // created by this method. This method returns true if successful. | 44 // created by this method. This method returns true if successful. |
| 45 // | 45 // |
| 46 // If the given path is relative, then it will be resolved against | 46 // If the given path is relative, then it will be resolved against |
| 47 // DIR_CURRENT. | 47 // DIR_CURRENT. |
| 48 // | 48 // |
| 49 // WARNING: Consumers of PathService::Get may expect paths to be constant | 49 // WARNING: Consumers of PathService::Get may expect paths to be constant |
| 50 // over the lifetime of the app, so this method should be used with caution. | 50 // over the lifetime of the app, so this method should be used with caution. |
| 51 static bool Override(int key, const FilePath& path); |
| 52 // This version, using a wstring, is deprecated and only kept around |
| 53 // until we can fix all callers. |
| 51 static bool Override(int key, const std::wstring& path); | 54 static bool Override(int key, const std::wstring& path); |
| 52 | 55 |
| 53 // Return whether a path was overridden. | 56 // Return whether a path was overridden. |
| 54 static bool IsOverridden(int key); | 57 static bool IsOverridden(int key); |
| 55 | 58 |
| 56 // Sets the current directory. | 59 // Sets the current directory. |
| 57 static bool SetCurrentDirectory(const std::wstring& current_directory); | 60 static bool SetCurrentDirectory(const std::wstring& current_directory); |
| 58 | 61 |
| 59 // To extend the set of supported keys, you can register a path provider, | 62 // To extend the set of supported keys, you can register a path provider, |
| 60 // which is just a function mirroring PathService::Get. The ProviderFunc | 63 // which is just a function mirroring PathService::Get. The ProviderFunc |
| (...skipping 10 matching lines...) Expand all Loading... |
| 71 static void RegisterProvider(ProviderFunc provider, | 74 static void RegisterProvider(ProviderFunc provider, |
| 72 int key_start, | 75 int key_start, |
| 73 int key_end); | 76 int key_end); |
| 74 private: | 77 private: |
| 75 static bool GetFromCache(int key, FilePath* path); | 78 static bool GetFromCache(int key, FilePath* path); |
| 76 static void AddToCache(int key, const FilePath& path); | 79 static void AddToCache(int key, const FilePath& path); |
| 77 | 80 |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 #endif // BASE_PATH_SERVICE_H__ | 83 #endif // BASE_PATH_SERVICE_H__ |
| OLD | NEW |