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

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

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
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 #if defined(OS_POSIX) && !defined(OS_MACOSX) 65 #if defined(OS_POSIX) && !defined(OS_MACOSX)
66 66
67 const FilePath::CharType kO3DPluginFileName[] = 67 const FilePath::CharType kO3DPluginFileName[] =
68 FILE_PATH_LITERAL("pepper/libppo3dautoplugin.so"); 68 FILE_PATH_LITERAL("pepper/libppo3dautoplugin.so");
69 69
70 const FilePath::CharType kGTalkPluginFileName[] = 70 const FilePath::CharType kGTalkPluginFileName[] =
71 FILE_PATH_LITERAL("pepper/libppgoogletalk.so"); 71 FILE_PATH_LITERAL("pepper/libppgoogletalk.so");
72 72
73 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 73 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
74
75 #if defined(OS_WIN)
76 // TODO(pastarmovj): Remove this copy of switches::kProcessType once we get
77 // better way to share constants between content and chrome. Using content
78 // switches makes all hell break loose on us when linking.
jam 2012/05/02 17:29:52 I don't understand this comment. Many switches in
pastarmovj 2012/05/03 16:48:24 After our offline discussion I came up with new ve
79 const char kProcessTypeSwitch[] = "type";
cpu_(ooo_6.6-7.5) 2012/05/02 17:33:48 asking john (jam) what is the way to go here.
80 #endif // defined(OS_WIN)
74 } // namespace 81 } // namespace
75 82
76 namespace chrome { 83 namespace chrome {
77 84
78 // Gets the path for internal plugins. 85 // Gets the path for internal plugins.
79 bool GetInternalPluginsDirectory(FilePath* result) { 86 bool GetInternalPluginsDirectory(FilePath* result) {
80 #if defined(OS_MACOSX) 87 #if defined(OS_MACOSX)
81 // If called from Chrome, get internal plugins from a subdirectory of the 88 // If called from Chrome, get internal plugins from a subdirectory of the
82 // framework. 89 // framework.
83 if (base::mac::AmIBundled()) { 90 if (base::mac::AmIBundled()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return PathService::Get(base::FILE_MODULE, result); 132 return PathService::Get(base::FILE_MODULE, result);
126 } 133 }
127 134
128 // Assume that we will not need to create the directory if it does not exist. 135 // Assume that we will not need to create the directory if it does not exist.
129 // This flag can be set to true for the cases where we want to create it. 136 // This flag can be set to true for the cases where we want to create it.
130 bool create_dir = false; 137 bool create_dir = false;
131 138
132 FilePath cur; 139 FilePath cur;
133 switch (key) { 140 switch (key) {
134 case chrome::DIR_USER_DATA: 141 case chrome::DIR_USER_DATA:
142 CHECK(ProcessNeedsProfileDir(
143 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
144 kProcessTypeSwitch)));
cpu_(ooo_6.6-7.5) 2012/05/02 17:33:48 thanks! no sandboxed process should me trafficking
pastarmovj 2012/05/03 16:48:24 I am glad to be useful :)
135 if (!GetDefaultUserDataDirectory(&cur)) { 145 if (!GetDefaultUserDataDirectory(&cur)) {
136 NOTREACHED(); 146 NOTREACHED();
137 return false; 147 return false;
138 } 148 }
139 create_dir = true; 149 create_dir = true;
140 break; 150 break;
141 case chrome::DIR_USER_DOCUMENTS: 151 case chrome::DIR_USER_DOCUMENTS:
142 if (!GetUserDocumentsDirectory(&cur)) 152 if (!GetUserDocumentsDirectory(&cur))
143 return false; 153 return false;
144 create_dir = true; 154 create_dir = true;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 return true; 412 return true;
403 } 413 }
404 414
405 // This cannot be done as a static initializer sadly since Visual Studio will 415 // This cannot be done as a static initializer sadly since Visual Studio will
406 // eliminate this object file if there is no direct entry point into it. 416 // eliminate this object file if there is no direct entry point into it.
407 void RegisterPathProvider() { 417 void RegisterPathProvider() {
408 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 418 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
409 } 419 }
410 420
411 } // namespace chrome 421 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698