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

Side by Side Diff: base/path_service.h

Issue 10909228: Add PathService::RemoveOverride to clear path overrides. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up a typo in unit tests file. Created 8 years, 3 months 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
« no previous file with comments | « no previous file | base/path_service.cc » ('j') | base/path_service.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/base_paths.h" 11 #include "base/base_paths.h"
12 #include "base/gtest_prod_util.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 14
14 class FilePath; 15 class FilePath;
15 16
16 // 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
17 // OK to use this service from multiple threads. 18 // OK to use this service from multiple threads.
18 // 19 //
19 class BASE_EXPORT PathService { 20 class BASE_EXPORT PathService {
20 public: 21 public:
21 // 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
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // WARNING: This function could be called on any thread from which the 55 // WARNING: This function could be called on any thread from which the
55 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE. 56 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE.
56 // 57 //
57 typedef bool (*ProviderFunc)(int, FilePath*); 58 typedef bool (*ProviderFunc)(int, FilePath*);
58 59
59 // Call to register a path provider. You must specify the range "[key_start, 60 // Call to register a path provider. You must specify the range "[key_start,
60 // key_end)" of supported path keys. 61 // key_end)" of supported path keys.
61 static void RegisterProvider(ProviderFunc provider, 62 static void RegisterProvider(ProviderFunc provider,
62 int key_start, 63 int key_start,
63 int key_end); 64 int key_end);
65
64 private: 66 private:
65 static bool GetFromCache(int key, FilePath* path); 67 FRIEND_TEST_ALL_PREFIXES(PathServiceTest, RemoveOverride);
66 static bool GetFromOverrides(int key, FilePath* path); 68
67 static void AddToCache(int key, const FilePath& path); 69 // Removes an override for a special directory or file. Returns true if there
70 // was an override to remove or false if none was present.
71 // NOTE: This function is intended to be used by tests only!
72 static bool RemoveOverride(int key);
68 }; 73 };
69 74
70 #endif // BASE_PATH_SERVICE_H_ 75 #endif // BASE_PATH_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | base/path_service.cc » ('j') | base/path_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698