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

Side by Side Diff: base/path_service.h

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove PathServiceWrapper and add DefaultDownloadDirectory Created 9 years, 6 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/browser/download/download_browsertest.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
11 #include "base/base_api.h" 11 #include "base/base_api.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_API 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
31 // Sets a path to a special directory or file. This overwrites the current
32 // path of the special directory or file. |path| may be a non-existent path.
33 static void Set(int key, const FilePath& path);
Paweł Hajdan Jr. 2011/06/08 09:50:23 Please remove all modifications to base/
haraken1 2011/06/09 10:16:56 Done.
34
31 // Overrides the path to a special directory or file. This cannot be used to 35 // Overrides the path to a special directory or file. This cannot be used to
32 // change the value of DIR_CURRENT, but that should be obvious. Also, if the 36 // change the value of DIR_CURRENT, but that should be obvious. Also, if the
33 // path specifies a directory that does not exist, the directory will be 37 // path specifies a directory that does not exist, the directory will be
34 // created by this method. This method returns true if successful. 38 // created by this method. This method returns true if successful.
35 // 39 //
36 // If the given path is relative, then it will be resolved against 40 // If the given path is relative, then it will be resolved against
37 // DIR_CURRENT. 41 // DIR_CURRENT.
38 // 42 //
39 // WARNING: Consumers of PathService::Get may expect paths to be constant 43 // 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. 44 // over the lifetime of the app, so this method should be used with caution.
(...skipping 14 matching lines...) Expand all
55 static void RegisterProvider(ProviderFunc provider, 59 static void RegisterProvider(ProviderFunc provider,
56 int key_start, 60 int key_start,
57 int key_end); 61 int key_end);
58 private: 62 private:
59 static bool GetFromCache(int key, FilePath* path); 63 static bool GetFromCache(int key, FilePath* path);
60 static bool GetFromOverrides(int key, FilePath* path); 64 static bool GetFromOverrides(int key, FilePath* path);
61 static void AddToCache(int key, const FilePath& path); 65 static void AddToCache(int key, const FilePath& path);
62 }; 66 };
63 67
64 #endif // BASE_PATH_SERVICE_H_ 68 #endif // BASE_PATH_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | base/path_service.cc » ('j') | chrome/browser/download/download_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698