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

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

Issue 10390003: Make sure only the main browser process and service processes are allowed to create the profile dir… (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_internal.h" 5 #include "chrome/common/chrome_paths_internal.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <knownfolders.h> 8 #include <knownfolders.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
11 #include <shobjidl.h> 11 #include <shobjidl.h>
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/win/metro.h" 14 #include "base/win/metro.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/win/scoped_co_mem.h" 16 #include "base/win/scoped_co_mem.h"
17 #include "chrome/common/chrome_constants.h" 17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/installer/util/browser_distribution.h" 18 #include "chrome/installer/util/browser_distribution.h"
19 #include "content/public/common/content_switches.h"
19 20
20 namespace chrome { 21 namespace chrome {
21 22
22 bool GetDefaultUserDataDirectory(FilePath* result) { 23 bool GetDefaultUserDataDirectory(FilePath* result) {
23 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) 24 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
24 return false; 25 return false;
25 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 26 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
26 *result = result->Append(dist->GetInstallSubDir()); 27 *result = result->Append(dist->GetInstallSubDir());
27 if (base::win::GetMetroModule()) 28 if (base::win::GetMetroModule())
28 *result = result->Append(kMetroChromeUserDataSubDir); 29 *result = result->Append(kMetroChromeUserDataSubDir);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // so we don't bother handling it. 91 // so we don't bother handling it.
91 wchar_t system_buffer[MAX_PATH]; 92 wchar_t system_buffer[MAX_PATH];
92 system_buffer[0] = 0; 93 system_buffer[0] = 0;
93 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, 94 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
94 SHGFP_TYPE_CURRENT, system_buffer))) 95 SHGFP_TYPE_CURRENT, system_buffer)))
95 return false; 96 return false;
96 *result = FilePath(system_buffer); 97 *result = FilePath(system_buffer);
97 return true; 98 return true;
98 } 99 }
99 100
101 bool ProcessNeedsProfileDir(const std::string& process_type) {
102 // On windows we don't want subprocesses other than the browser process and
103 // service processes to be able to use the profile directory because if it
104 // lies on a network share the sandbox will prevent us from accessing it.
105 // TODO(pastarmovj): For now gpu and plugin broker processes are whitelisted
106 // too because they do use the profile dir in some way but this must be
107 // investigated and fixed if possible.
108 return process_type.empty() ||
109 process_type == switches::kServiceProcess ||
110 process_type == switches::kGpuProcess ||
111 process_type == switches::kNaClBrokerProcess ||
112 process_type == switches::kNaClLoaderProcess ||
113 process_type == switches::kPpapiBrokerProcess;
114 }
115
100 } // namespace chrome 116 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698