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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 8463020: Make sure only the right processes can access the profile path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added user notification for network profiles. Created 8 years, 11 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 66 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
67 #include "chrome/browser/process_singleton.h" 67 #include "chrome/browser/process_singleton.h"
68 #include "chrome/browser/profiles/profile.h" 68 #include "chrome/browser/profiles/profile.h"
69 #include "chrome/browser/profiles/profile_manager.h" 69 #include "chrome/browser/profiles/profile_manager.h"
70 #include "chrome/browser/search_engines/search_engine_type.h" 70 #include "chrome/browser/search_engines/search_engine_type.h"
71 #include "chrome/browser/search_engines/template_url.h" 71 #include "chrome/browser/search_engines/template_url.h"
72 #include "chrome/browser/search_engines/template_url_service.h" 72 #include "chrome/browser/search_engines/template_url_service.h"
73 #include "chrome/browser/search_engines/template_url_service_factory.h" 73 #include "chrome/browser/search_engines/template_url_service_factory.h"
74 #include "chrome/browser/service/service_process_control.h" 74 #include "chrome/browser/service/service_process_control.h"
75 #include "chrome/browser/shell_integration.h" 75 #include "chrome/browser/shell_integration.h"
76 #include "chrome/browser/simple_message_box.h"
76 #include "chrome/browser/translate/translate_manager.h" 77 #include "chrome/browser/translate/translate_manager.h"
77 #include "chrome/browser/ui/browser.h" 78 #include "chrome/browser/ui/browser.h"
78 #include "chrome/browser/ui/browser_init.h" 79 #include "chrome/browser/ui/browser_init.h"
79 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 80 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
80 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" 81 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h"
81 #include "chrome/common/child_process_logging.h" 82 #include "chrome/common/child_process_logging.h"
82 #include "chrome/common/chrome_constants.h" 83 #include "chrome/common/chrome_constants.h"
83 #include "chrome/common/chrome_paths.h" 84 #include "chrome/common/chrome_paths.h"
84 #include "chrome/common/chrome_result_codes.h" 85 #include "chrome/common/chrome_result_codes.h"
85 #include "chrome/common/chrome_switches.h" 86 #include "chrome/common/chrome_switches.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #include "chrome/browser/chromeos/cros_settings.h" 134 #include "chrome/browser/chromeos/cros_settings.h"
134 #include "chrome/browser/chromeos/cros_settings_names.h" 135 #include "chrome/browser/chromeos/cros_settings_names.h"
135 #endif 136 #endif
136 137
137 // TODO(port): several win-only methods have been pulled out of this, but 138 // TODO(port): several win-only methods have been pulled out of this, but
138 // BrowserMain() as a whole needs to be broken apart so that it's usable by 139 // BrowserMain() as a whole needs to be broken apart so that it's usable by
139 // other platforms. For now, it's just a stub. This is a serious work in 140 // other platforms. For now, it's just a stub. This is a serious work in
140 // progress and should not be taken as an indication of a real refactoring. 141 // progress and should not be taken as an indication of a real refactoring.
141 142
142 #if defined(OS_WIN) 143 #if defined(OS_WIN)
144 #include <wtsapi32.h>
143 #include "base/environment.h" // For PreRead experiment. 145 #include "base/environment.h" // For PreRead experiment.
144 #include "base/win/windows_version.h" 146 #include "base/win/windows_version.h"
145 #include "chrome/browser/browser_trial.h" 147 #include "chrome/browser/browser_trial.h"
146 #include "chrome/browser/browser_util_win.h" 148 #include "chrome/browser/browser_util_win.h"
147 #include "chrome/browser/chrome_browser_main_win.h" 149 #include "chrome/browser/chrome_browser_main_win.h"
148 #include "chrome/browser/first_run/try_chrome_dialog_view.h" 150 #include "chrome/browser/first_run/try_chrome_dialog_view.h"
149 #include "chrome/browser/first_run/upgrade_util_win.h" 151 #include "chrome/browser/first_run/upgrade_util_win.h"
150 #include "chrome/browser/fragmentation_checker_win.h" 152 #include "chrome/browser/fragmentation_checker_win.h"
151 #include "chrome/browser/net/url_fixer_upper.h" 153 #include "chrome/browser/net/url_fixer_upper.h"
152 #include "chrome/browser/rlz/rlz.h" 154 #include "chrome/browser/rlz/rlz.h"
153 #include "chrome/browser/ui/views/user_data_dir_dialog.h" 155 #include "chrome/browser/ui/views/user_data_dir_dialog.h"
154 #include "chrome/installer/util/helper.h" 156 #include "chrome/installer/util/helper.h"
155 #include "chrome/installer/util/install_util.h" 157 #include "chrome/installer/util/install_util.h"
156 #include "chrome/installer/util/shell_util.h" 158 #include "chrome/installer/util/shell_util.h"
157 #include "net/base/net_util.h" 159 #include "net/base/net_util.h"
158 #include "printing/printed_document.h" 160 #include "printing/printed_document.h"
159 #include "ui/base/l10n/l10n_util_win.h" 161 #include "ui/base/l10n/l10n_util_win.h"
162
163 // Make sure we link the wtsapi lib file in.
164 #pragma comment(lib, "wtsapi32.lib")
160 #endif // defined(OS_WIN) 165 #endif // defined(OS_WIN)
161 166
162 #if defined(OS_MACOSX) 167 #if defined(OS_MACOSX)
163 #include <Security/Security.h> 168 #include <Security/Security.h>
164 169
165 #include "base/mac/scoped_nsautorelease_pool.h" 170 #include "base/mac/scoped_nsautorelease_pool.h"
166 #include "chrome/browser/mac/install_from_dmg.h" 171 #include "chrome/browser/mac/install_from_dmg.h"
167 #include "chrome/browser/mac/keystone_glue.h" 172 #include "chrome/browser/mac/keystone_glue.h"
168 #endif 173 #endif
169 174
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 FilePath resources_pack_path; 1184 FilePath resources_pack_path;
1180 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); 1185 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
1181 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 1186 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
1182 #endif // defined(OS_MACOSX) 1187 #endif // defined(OS_MACOSX)
1183 } 1188 }
1184 1189
1185 #if defined(TOOLKIT_GTK) 1190 #if defined(TOOLKIT_GTK)
1186 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); 1191 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
1187 #endif 1192 #endif
1188 1193
1194 #if defined(OS_WIN)
1195 // On windows notify the user if he is serving his profile from a network
1196 // share as we don't officially support this setup yet.
1197 // However we don't want to bother users on Cytrix setups as those have no
1198 // real choice and their admins must be well aware of the risks associated.
1199 LPWSTR buffer = NULL;
1200 DWORD buffer_length = 0;
1201 if (::WTSQuerySessionInformation(WTS_CURRENT_SERVER, WTS_CURRENT_SESSION,
1202 WTSClientProtocolType,
1203 &buffer, &buffer_length)) {
1204 CHECK(buffer_length == sizeof(USHORT));
1205 USHORT* type = reinterpret_cast<USHORT*>(buffer);
1206 // Zero means local environment and we should warn the user if he runs
1207 // on a network share.
1208 if (*type == 0) {
1209 bool profile_on_network = false;
1210 FilePath temp_file;
1211 // Try to create some non-empty temp file in the profile dir and use
1212 // it to check if there is a reparse-point free path to it.
1213 if (file_util::CreateTemporaryFileInDir(user_data_dir_, &temp_file) &&
1214 file_util::WriteFile(temp_file, ".", 1)) {
1215 FilePath normalized_temp_file;
1216 if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file))
1217 profile_on_network = true;
1218 }
1219 file_util::Delete(temp_file, false);
1220 if (profile_on_network) {
1221 browser::ShowErrorBox(NULL,
1222 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
1223 l10n_util::GetStringUTF16(
1224 IDS_PROFILE_ON_NETWORK_WARNING));
1225 }
1226 } // Local session.
1227 ::WTSFreeMemory(buffer);
1228 } // WTSQuerySessionInformation succeeded.
1229 #endif
1230
1189 // These members must be initialized before returning from this function. 1231 // These members must be initialized before returning from this function.
1190 master_prefs_.reset(new FirstRun::MasterPrefs); 1232 master_prefs_.reset(new FirstRun::MasterPrefs);
1191 browser_init_.reset(new BrowserInit); 1233 browser_init_.reset(new BrowserInit);
1192 1234
1193 std::string try_chrome = 1235 std::string try_chrome =
1194 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); 1236 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain);
1195 if (!try_chrome.empty()) { 1237 if (!try_chrome.empty()) {
1196 #if defined(OS_WIN) && !defined(USE_AURA) 1238 #if defined(OS_WIN) && !defined(USE_AURA)
1197 // Setup.exe has determined that we need to run a retention experiment 1239 // Setup.exe has determined that we need to run a retention experiment
1198 // and has lauched chrome to show the experiment UI. 1240 // and has lauched chrome to show the experiment UI.
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 if (base::win::GetVersion() <= base::win::VERSION_XP) 1994 if (base::win::GetVersion() <= base::win::VERSION_XP)
1953 uma_name += "_XP"; 1995 uma_name += "_XP";
1954 1996
1955 uma_name += "_PreRead"; 1997 uma_name += "_PreRead";
1956 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 1998 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
1957 AddPreReadHistogramTime(uma_name.c_str(), time); 1999 AddPreReadHistogramTime(uma_name.c_str(), time);
1958 } 2000 }
1959 #endif 2001 #endif
1960 #endif 2002 #endif
1961 } 2003 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698