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

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: Refactored the locking semantics. 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"
(...skipping 28 matching lines...) Expand all
39 // over the lifetime of the app, so this method should be used with caution. 39 // over the lifetime of the app, so this method should be used with caution.
40 static bool Override(int key, const FilePath& path); 40 static bool Override(int key, const FilePath& path);
41 41
42 // This function does the same as PathService::Override but it takes an extra 42 // This function does the same as PathService::Override but it takes an extra
43 // parameter |create| which guides whether the directory to be overriden must 43 // parameter |create| which guides whether the directory to be overriden must
44 // be created in case it doesn't exist already. 44 // be created in case it doesn't exist already.
45 static bool OverrideAndCreateIfNeeded(int key, 45 static bool OverrideAndCreateIfNeeded(int key,
46 const FilePath& path, 46 const FilePath& path,
47 bool create); 47 bool create);
48 48
49 // Removes an override for a special directory or file. Returns true if there
50 // was an override to remove or false if none was present.
51 static bool RemoveOverride(int key);
52
49 // To extend the set of supported keys, you can register a path provider, 53 // To extend the set of supported keys, you can register a path provider,
50 // which is just a function mirroring PathService::Get. The ProviderFunc 54 // which is just a function mirroring PathService::Get. The ProviderFunc
51 // returns false if it cannot provide a non-empty path for the given key. 55 // returns false if it cannot provide a non-empty path for the given key.
52 // Otherwise, true is returned. 56 // Otherwise, true is returned.
53 // 57 //
54 // WARNING: This function could be called on any thread from which the 58 // WARNING: This function could be called on any thread from which the
55 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE. 59 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE.
56 // 60 //
57 typedef bool (*ProviderFunc)(int, FilePath*); 61 typedef bool (*ProviderFunc)(int, FilePath*);
58 62
59 // Call to register a path provider. You must specify the range "[key_start, 63 // Call to register a path provider. You must specify the range "[key_start,
60 // key_end)" of supported path keys. 64 // key_end)" of supported path keys.
61 static void RegisterProvider(ProviderFunc provider, 65 static void RegisterProvider(ProviderFunc provider,
62 int key_start, 66 int key_start,
63 int key_end); 67 int key_end);
64 private:
65 static bool GetFromCache(int key, FilePath* path);
66 static bool GetFromOverrides(int key, FilePath* path);
67 static void AddToCache(int key, const FilePath& path);
68 }; 68 };
69 69
70 #endif // BASE_PATH_SERVICE_H_ 70 #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