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

Side by Side Diff: base/path_service.h

Issue 5123004: chrome_paths: refactor and sanitize cache directory handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « base/base_paths_mac.mm ('k') | base/path_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 27 matching lines...) Expand all
38 // path specifies a directory that does not exist, the directory will be 38 // path specifies a directory that does not exist, the directory will be
39 // created by this method. This method returns true if successful. 39 // created by this method. This method returns true if successful.
40 // 40 //
41 // If the given path is relative, then it will be resolved against 41 // If the given path is relative, then it will be resolved against
42 // DIR_CURRENT. 42 // DIR_CURRENT.
43 // 43 //
44 // WARNING: Consumers of PathService::Get may expect paths to be constant 44 // WARNING: Consumers of PathService::Get may expect paths to be constant
45 // over the lifetime of the app, so this method should be used with caution. 45 // over the lifetime of the app, so this method should be used with caution.
46 static bool Override(int key, const FilePath& path); 46 static bool Override(int key, const FilePath& path);
47 47
48 // Return whether a path was overridden.
49 // TODO(evan): temporarily restoring this to quick-fix a regression.
50 // Remove me again once it's fixed properly.
51 static bool IsOverridden(int key);
52
53 // To extend the set of supported keys, you can register a path provider, 48 // To extend the set of supported keys, you can register a path provider,
54 // which is just a function mirroring PathService::Get. The ProviderFunc 49 // which is just a function mirroring PathService::Get. The ProviderFunc
55 // returns false if it cannot provide a non-empty path for the given key. 50 // returns false if it cannot provide a non-empty path for the given key.
56 // Otherwise, true is returned. 51 // Otherwise, true is returned.
57 // 52 //
58 // WARNING: This function could be called on any thread from which the 53 // WARNING: This function could be called on any thread from which the
59 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE. 54 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE.
60 // 55 //
61 typedef bool (*ProviderFunc)(int, FilePath*); 56 typedef bool (*ProviderFunc)(int, FilePath*);
62 57
63 // Call to register a path provider. You must specify the range "[key_start, 58 // Call to register a path provider. You must specify the range "[key_start,
64 // key_end)" of supported path keys. 59 // key_end)" of supported path keys.
65 static void RegisterProvider(ProviderFunc provider, 60 static void RegisterProvider(ProviderFunc provider,
66 int key_start, 61 int key_start,
67 int key_end); 62 int key_end);
68 private: 63 private:
69 static bool GetFromCache(int key, FilePath* path); 64 static bool GetFromCache(int key, FilePath* path);
70 static bool GetFromOverrides(int key, FilePath* path); 65 static bool GetFromOverrides(int key, FilePath* path);
71 static void AddToCache(int key, const FilePath& path); 66 static void AddToCache(int key, const FilePath& path);
72 }; 67 };
73 68
74 #endif // BASE_PATH_SERVICE_H_ 69 #endif // BASE_PATH_SERVICE_H_
OLDNEW
« no previous file with comments | « base/base_paths_mac.mm ('k') | base/path_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698