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

Side by Side Diff: base/path_service.h

Issue 10306009: Make sure only the main browser process and service proceses are allowed to create the profile dire… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/path_service.cc » ('j') | chrome/common/chrome_paths.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 22 matching lines...) Expand all
33 // path specifies a directory that does not exist, the directory will be 33 // path specifies a directory that does not exist, the directory will be
34 // created by this method. This method returns true if successful. 34 // created by this method. This method returns true if successful.
35 // 35 //
36 // If the given path is relative, then it will be resolved against 36 // If the given path is relative, then it will be resolved against
37 // DIR_CURRENT. 37 // DIR_CURRENT.
38 // 38 //
39 // WARNING: Consumers of PathService::Get may expect paths to be constant 39 // WARNING: Consumers of PathService::Get may expect paths to be constant
40 // over the lifetime of the app, so this method should be used with caution. 40 // over the lifetime of the app, so this method should be used with caution.
41 static bool Override(int key, const FilePath& path); 41 static bool Override(int key, const FilePath& path);
42 42
43 // Overrides the path to a special directory or file. This cannot be used to
willchan no longer on Chromium 2012/05/02 17:42:34 Rather than copying the comment from above, how ab
pastarmovj 2012/05/03 16:48:24 Done.
44 // change the value of DIR_CURRENT, but that should be obvious. Also, if the
45 // path specifies a directory that does not exist, the directory will be
46 // created if the |create| flag is set to true. This method returns true if
47 // successful.
48 //
49 // If the given path is relative, then it will be resolved against
50 // DIR_CURRENT.
51 //
52 // WARNING: Consumers of PathService::Get may expect paths to be constant
53 // over the lifetime of the app, so this method should be used with caution.
54 static bool OverrideAndCreateIfNeeded(int key,
55 const FilePath& path,
56 bool create);
57
43 // To extend the set of supported keys, you can register a path provider, 58 // To extend the set of supported keys, you can register a path provider,
44 // which is just a function mirroring PathService::Get. The ProviderFunc 59 // which is just a function mirroring PathService::Get. The ProviderFunc
45 // returns false if it cannot provide a non-empty path for the given key. 60 // returns false if it cannot provide a non-empty path for the given key.
46 // Otherwise, true is returned. 61 // Otherwise, true is returned.
47 // 62 //
48 // WARNING: This function could be called on any thread from which the 63 // WARNING: This function could be called on any thread from which the
49 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE. 64 // PathService is used, so a the ProviderFunc MUST BE THREADSAFE.
50 // 65 //
51 typedef bool (*ProviderFunc)(int, FilePath*); 66 typedef bool (*ProviderFunc)(int, FilePath*);
52 67
53 // Call to register a path provider. You must specify the range "[key_start, 68 // Call to register a path provider. You must specify the range "[key_start,
54 // key_end)" of supported path keys. 69 // key_end)" of supported path keys.
55 static void RegisterProvider(ProviderFunc provider, 70 static void RegisterProvider(ProviderFunc provider,
56 int key_start, 71 int key_start,
57 int key_end); 72 int key_end);
58 private: 73 private:
59 static bool GetFromCache(int key, FilePath* path); 74 static bool GetFromCache(int key, FilePath* path);
60 static bool GetFromOverrides(int key, FilePath* path); 75 static bool GetFromOverrides(int key, FilePath* path);
61 static void AddToCache(int key, const FilePath& path); 76 static void AddToCache(int key, const FilePath& path);
62 }; 77 };
63 78
64 #endif // BASE_PATH_SERVICE_H_ 79 #endif // BASE_PATH_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | base/path_service.cc » ('j') | chrome/common/chrome_paths.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698