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

Side by Side Diff: base/path_service.cc

Issue 10910209: Add new PathService paths for Windows' All Users Desktop and Quick Launch folders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust links to pass presubmit 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 | Annotate | Revision Log
« no previous file with comments | « base/base_paths_win.cc ('k') | base/path_service_unittest.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) 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 #include "base/path_service.h" 5 #include "base/path_service.h"
6 6
7 #ifdef OS_WIN 7 #ifdef OS_WIN
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
11 #endif 11 #endif
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/hash_tables.h" 15 #include "base/hash_tables.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 19
20 namespace base { 20 namespace base {
21 bool PathProvider(int key, FilePath* result); 21 bool PathProvider(int key, FilePath* result);
22 #if defined(OS_WIN) 22 #if defined(OS_WIN)
23 bool PathProviderWin(int key, FilePath* result); 23 bool PathProviderWin(int key, FilePath* result);
24 #elif defined(OS_MACOSX) 24 #elif defined(OS_MACOSX)
25 bool PathProviderMac(int key, FilePath* result); 25 bool PathProviderMac(int key, FilePath* result);
26 #elif defined(OS_ANDROID) 26 #elif defined(OS_ANDROID)
27 bool PathProviderAndroid(int key, FilePath* result); 27 bool PathProviderAndroid(int key, FilePath* result);
28 #elif defined(OS_POSIX) 28 #elif defined(OS_POSIX)
29 // PathProviderPosix is the default path provider on POSIX OSes other than
30 // Mac and Android.
29 bool PathProviderPosix(int key, FilePath* result); 31 bool PathProviderPosix(int key, FilePath* result);
30 #endif 32 #endif
31 } 33 }
32 34
33 namespace { 35 namespace {
34 36
35 typedef base::hash_map<int, FilePath> PathMap; 37 typedef base::hash_map<int, FilePath> PathMap;
36 38
37 // We keep a linked list of providers. In a debug build we ensure that no two 39 // We keep a linked list of providers. In a debug build we ensure that no two
38 // providers claim overlapping keys. 40 // providers claim overlapping keys.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #endif 80 #endif
79 true 81 true
80 }; 82 };
81 #endif 83 #endif
82 84
83 #if defined(OS_ANDROID) 85 #if defined(OS_ANDROID)
84 Provider base_provider_android = { 86 Provider base_provider_android = {
85 base::PathProviderAndroid, 87 base::PathProviderAndroid,
86 &base_provider, 88 &base_provider,
87 #ifndef NDEBUG 89 #ifndef NDEBUG
88 0, 90 base::PATH_ANDROID_START,
89 0, 91 base::PATH_ANDROID_END,
90 #endif 92 #endif
91 true 93 true
92 }; 94 };
93 #endif 95 #endif
94 96
95 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 97 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
96 Provider base_provider_posix = { 98 Provider base_provider_posix = {
97 base::PathProviderPosix, 99 base::PathProviderPosix,
98 &base_provider, 100 &base_provider,
99 #ifndef NDEBUG 101 #ifndef NDEBUG
100 0, 102 base::PATH_POSIX_START,
101 0, 103 base::PATH_POSIX_END,
102 #endif 104 #endif
103 true 105 true
104 }; 106 };
105 #endif 107 #endif
106 108
107 109
108 struct PathData { 110 struct PathData {
109 base::Lock lock; 111 base::Lock lock;
110 PathMap cache; // Cache mappings from path key to path value. 112 PathMap cache; // Cache mappings from path key to path value.
111 PathMap overrides; // Track path overrides. 113 PathMap overrides; // Track path overrides.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 p = new Provider; 288 p = new Provider;
287 p->is_static = false; 289 p->is_static = false;
288 p->func = func; 290 p->func = func;
289 p->next = path_data->providers; 291 p->next = path_data->providers;
290 #ifndef NDEBUG 292 #ifndef NDEBUG
291 p->key_start = key_start; 293 p->key_start = key_start;
292 p->key_end = key_end; 294 p->key_end = key_end;
293 #endif 295 #endif
294 path_data->providers = p; 296 path_data->providers = p;
295 } 297 }
OLDNEW
« no previous file with comments | « base/base_paths_win.cc ('k') | base/path_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698