OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/base_api.h" | 11 #include "base/base_export.h" |
12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 | 14 |
15 class FilePath; | 15 class FilePath; |
16 | 16 |
17 // The path service is a global table mapping keys to file system paths. It is | 17 // The path service is a global table mapping keys to file system paths. It is |
18 // OK to use this service from multiple threads. | 18 // OK to use this service from multiple threads. |
19 // | 19 // |
20 class BASE_API PathService { | 20 class BASE_EXPORT PathService { |
21 public: | 21 public: |
22 // Retrieves a path to a special directory or file and places it into the | 22 // Retrieves a path to a special directory or file and places it into the |
23 // string pointed to by 'path'. If you ask for a directory it is guaranteed | 23 // string pointed to by 'path'. If you ask for a directory it is guaranteed |
24 // to NOT have a path separator at the end. For example, "c:\windows\temp" | 24 // to NOT have a path separator at the end. For example, "c:\windows\temp" |
25 // Directories are also guaranteed to exist when this function succeeds. | 25 // Directories are also guaranteed to exist when this function succeeds. |
26 // | 26 // |
27 // Returns true if the directory or file was successfully retrieved. On | 27 // Returns true if the directory or file was successfully retrieved. On |
28 // failure, 'path' will not be changed. | 28 // failure, 'path' will not be changed. |
29 static bool Get(int key, FilePath* path); | 29 static bool Get(int key, FilePath* path); |
30 | 30 |
(...skipping 24 matching lines...) Expand all Loading... |
55 static void RegisterProvider(ProviderFunc provider, | 55 static void RegisterProvider(ProviderFunc provider, |
56 int key_start, | 56 int key_start, |
57 int key_end); | 57 int key_end); |
58 private: | 58 private: |
59 static bool GetFromCache(int key, FilePath* path); | 59 static bool GetFromCache(int key, FilePath* path); |
60 static bool GetFromOverrides(int key, FilePath* path); | 60 static bool GetFromOverrides(int key, FilePath* path); |
61 static void AddToCache(int key, const FilePath& path); | 61 static void AddToCache(int key, const FilePath& path); |
62 }; | 62 }; |
63 | 63 |
64 #endif // BASE_PATH_SERVICE_H_ | 64 #endif // BASE_PATH_SERVICE_H_ |
OLD | NEW |