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

Side by Side Diff: chrome/common/chrome_paths.cc

Issue 10392094: Add PathService::Get(chrome::DIR_USER_PICTURES). (Closed) Base URL: svn://chrome-svn/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
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 "chrome/common/chrome_paths.h" 5 #include "chrome/common/chrome_paths.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return PathService::Get(base::FILE_MODULE, result); 138 return PathService::Get(base::FILE_MODULE, result);
139 } 139 }
140 140
141 // Assume that we will not need to create the directory if it does not exist. 141 // Assume that we will not need to create the directory if it does not exist.
142 // This flag can be set to true for the cases where we want to create it. 142 // This flag can be set to true for the cases where we want to create it.
143 bool create_dir = false; 143 bool create_dir = false;
144 144
145 FilePath cur; 145 FilePath cur;
146 switch (key) { 146 switch (key) {
147 case chrome::DIR_USER_DATA: { 147 case chrome::DIR_USER_DATA: {
148 CommandLine *cmd_line = CommandLine::ForCurrentProcess(); 148 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
149 if (cmd_line) { 149 if (cmd_line) {
150 // In some tests this check might be happening after the CommandLine 150 // In some tests this check might be happening after the CommandLine
151 // object has been destroyed. This is DCHECKED but in release builds 151 // object has been destroyed. This is DCHECKED but in release builds
152 // it might lead to a crash here. 152 // it might lead to a crash here.
153 CHECK(ProcessNeedsProfileDir(cmd_line->GetSwitchValueASCII( 153 CHECK(ProcessNeedsProfileDir(cmd_line->GetSwitchValueASCII(
154 switches::kProcessType))); 154 switches::kProcessType)));
155 } 155 }
156 if (!GetDefaultUserDataDirectory(&cur)) { 156 if (!GetDefaultUserDataDirectory(&cur)) {
157 NOTREACHED(); 157 NOTREACHED();
158 return false; 158 return false;
159 } 159 }
160 create_dir = true; 160 create_dir = true;
161 break; 161 break;
162 } 162 }
163 case chrome::DIR_USER_DOCUMENTS: 163 case chrome::DIR_USER_DOCUMENTS:
164 if (!GetUserDocumentsDirectory(&cur)) 164 if (!GetUserDocumentsDirectory(&cur))
165 return false; 165 return false;
166 create_dir = true; 166 create_dir = true;
167 break; 167 break;
168 case chrome::DIR_USER_PICTURES:
169 if (!GetUserPicturesDirectory(&cur))
170 return false;
171 break;
168 case chrome::DIR_DEFAULT_DOWNLOADS_SAFE: 172 case chrome::DIR_DEFAULT_DOWNLOADS_SAFE:
169 #if defined(OS_WIN) || defined(OS_LINUX) 173 #if defined(OS_WIN) || defined(OS_LINUX)
170 if (!GetUserDownloadsDirectorySafe(&cur)) 174 if (!GetUserDownloadsDirectorySafe(&cur))
171 return false; 175 return false;
172 break; 176 break;
173 #else 177 #else
174 // Fall through for all other platforms. 178 // Fall through for all other platforms.
175 #endif 179 #endif
176 case chrome::DIR_DEFAULT_DOWNLOADS: 180 case chrome::DIR_DEFAULT_DOWNLOADS:
177 if (!GetUserDownloadsDirectory(&cur)) 181 if (!GetUserDownloadsDirectory(&cur))
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 return true; 434 return true;
431 } 435 }
432 436
433 // This cannot be done as a static initializer sadly since Visual Studio will 437 // This cannot be done as a static initializer sadly since Visual Studio will
434 // eliminate this object file if there is no direct entry point into it. 438 // eliminate this object file if there is no direct entry point into it.
435 void RegisterPathProvider() { 439 void RegisterPathProvider() {
436 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 440 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
437 } 441 }
438 442
439 } // namespace chrome 443 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698