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

Side by Side Diff: base/path_service.cc

Issue 293013: Deprecate PathService::Get(..., wstring*) and use FilePath instead. (Closed)
Patch Set: Created 11 years, 2 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
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 #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>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 if (path.empty()) 182 if (path.empty())
183 return false; 183 return false;
184 184
185 AddToCache(key, path); 185 AddToCache(key, path);
186 186
187 *result = path; 187 *result = path;
188 return true; 188 return true;
189 } 189 }
190 190
191 #if defined(OS_WIN)
191 // static 192 // static
192 bool PathService::Get(int key, std::wstring* result) { 193 bool PathService::Get(int key, std::wstring* result) {
193 // Deprecated compatibility function. 194 // Deprecated compatibility function.
194 FilePath path; 195 FilePath path;
195 if (!Get(key, &path)) 196 if (!Get(key, &path))
196 return false; 197 return false;
197 *result = path.ToWStringHack(); 198 *result = path.ToWStringHack();
198 return true; 199 return true;
199 } 200 }
201 #endif
200 202
201 bool PathService::IsOverridden(int key) { 203 bool PathService::IsOverridden(int key) {
202 PathData* path_data = GetPathData(); 204 PathData* path_data = GetPathData();
203 DCHECK(path_data); 205 DCHECK(path_data);
204 206
205 AutoLock scoped_lock(path_data->lock); 207 AutoLock scoped_lock(path_data->lock);
206 return path_data->overrides.find(key) != path_data->overrides.end(); 208 return path_data->overrides.find(key) != path_data->overrides.end();
207 } 209 }
208 210
209 bool PathService::Override(int key, const FilePath& path) { 211 bool PathService::Override(int key, const FilePath& path) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 p = new Provider; 255 p = new Provider;
254 p->is_static = false; 256 p->is_static = false;
255 p->func = func; 257 p->func = func;
256 p->next = path_data->providers; 258 p->next = path_data->providers;
257 #ifndef NDEBUG 259 #ifndef NDEBUG
258 p->key_start = key_start; 260 p->key_start = key_start;
259 p->key_end = key_end; 261 p->key_end = key_end;
260 #endif 262 #endif
261 path_data->providers = p; 263 path_data->providers = p;
262 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698