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

Side by Side Diff: chrome/common/chrome_paths_win.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: Fix mac compile 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
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/base_paths_win.h"
13 #include "base/command_line.h" 14 #include "base/command_line.h"
14 #include "base/file_path.h" 15 #include "base/file_path.h"
15 #include "base/path_service.h" 16 #include "base/path_service.h"
16 #include "base/win/metro.h" 17 #include "base/win/metro.h"
17 #include "base/win/scoped_co_mem.h" 18 #include "base/win/scoped_co_mem.h"
18 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/installer/util/browser_distribution.h" 21 #include "chrome/installer/util/browser_distribution.h"
21 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
22 23
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 bool GetUserPicturesDirectory(FilePath* result) { 111 bool GetUserPicturesDirectory(FilePath* result) {
111 wchar_t path_buf[MAX_PATH]; 112 wchar_t path_buf[MAX_PATH];
112 if (FAILED(SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, 113 if (FAILED(SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL,
113 SHGFP_TYPE_CURRENT, path_buf))) { 114 SHGFP_TYPE_CURRENT, path_buf))) {
114 return false; 115 return false;
115 } 116 }
116 *result = FilePath(path_buf); 117 *result = FilePath(path_buf);
117 return true; 118 return true;
118 } 119 }
119 120
120 bool GetUserDesktop(FilePath* result) {
121 // We need to go compute the value. It would be nice to support paths
122 // with names longer than MAX_PATH, but the system functions don't seem
123 // to be designed for it either, with the exception of GetTempPath
124 // (but other things will surely break if the temp path is too long,
125 // so we don't bother handling it.
126 wchar_t system_buffer[MAX_PATH];
127 system_buffer[0] = 0;
128 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
129 SHGFP_TYPE_CURRENT, system_buffer))) {
130 return false;
131 }
132 *result = FilePath(system_buffer);
133 return true;
134 }
135
136 bool ProcessNeedsProfileDir(const std::string& process_type) { 121 bool ProcessNeedsProfileDir(const std::string& process_type) {
137 // On windows we don't want subprocesses other than the browser process and 122 // On windows we don't want subprocesses other than the browser process and
138 // service processes to be able to use the profile directory because if it 123 // service processes to be able to use the profile directory because if it
139 // lies on a network share the sandbox will prevent us from accessing it. 124 // lies on a network share the sandbox will prevent us from accessing it.
140 // TODO(pastarmovj): For now gpu and plugin broker processes are whitelisted 125 // TODO(pastarmovj): For now gpu and plugin broker processes are whitelisted
141 // too because they do use the profile dir in some way but this must be 126 // too because they do use the profile dir in some way but this must be
142 // investigated and fixed if possible. 127 // investigated and fixed if possible.
143 return process_type.empty() || 128 return process_type.empty() ||
144 process_type == switches::kServiceProcess || 129 process_type == switches::kServiceProcess ||
145 process_type == switches::kGpuProcess || 130 process_type == switches::kGpuProcess ||
146 process_type == switches::kNaClBrokerProcess || 131 process_type == switches::kNaClBrokerProcess ||
147 process_type == switches::kNaClLoaderProcess || 132 process_type == switches::kNaClLoaderProcess ||
148 process_type == switches::kPpapiBrokerProcess; 133 process_type == switches::kPpapiBrokerProcess;
149 } 134 }
150 135
151 } // namespace chrome 136 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698