OLD | NEW |
---|---|
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 <windows.h> | 5 #include <windows.h> |
6 #include <shlwapi.h> | 6 #include <shlwapi.h> |
7 | 7 |
8 #include "base/base_paths.h" | |
8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
10 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
11 #include "base/environment.h" | 12 #include "base/environment.h" |
12 #include "base/file_version_info.h" | 13 #include "base/file_version_info.h" |
13 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/path_service.h" | |
16 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
17 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
19 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
20 #include "base/version.h" | 22 #include "base/version.h" |
21 #include "base/win/scoped_handle.h" | 23 #include "base/win/scoped_handle.h" |
22 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
23 #include "chrome/app/chrome_crash_reporter_client.h" | 25 #include "chrome/app/chrome_crash_reporter_client.h" |
24 #include "chrome/app/chrome_watcher_client_win.h" | 26 #include "chrome/app/chrome_watcher_client_win.h" |
25 #include "chrome/app/chrome_watcher_command_line_win.h" | 27 #include "chrome/app/chrome_watcher_command_line_win.h" |
26 #include "chrome/app/client_util.h" | 28 #include "chrome/app/client_util.h" |
27 #include "chrome/app/image_pre_reader_win.h" | 29 #include "chrome/app/image_pre_reader_win.h" |
28 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" | 30 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" |
29 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
30 #include "chrome/common/chrome_result_codes.h" | 32 #include "chrome/common/chrome_result_codes.h" |
31 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/env_vars.h" | 34 #include "chrome/common/env_vars.h" |
35 #include "chrome/installer/util/browser_distribution.h" | |
33 #include "chrome/installer/util/google_update_constants.h" | 36 #include "chrome/installer/util/google_update_constants.h" |
34 #include "chrome/installer/util/google_update_settings.h" | 37 #include "chrome/installer/util/google_update_settings.h" |
35 #include "chrome/installer/util/install_util.h" | 38 #include "chrome/installer/util/install_util.h" |
36 #include "chrome/installer/util/util_constants.h" | 39 #include "chrome/installer/util/util_constants.h" |
37 #include "components/crash/app/breakpad_win.h" | 40 #include "components/crash/app/breakpad_win.h" |
38 #include "components/crash/app/crash_reporter_client.h" | 41 #include "components/crash/app/crash_reporter_client.h" |
39 #include "components/metrics/client_info.h" | 42 #include "components/metrics/client_info.h" |
40 #include "content/public/app/startup_helper_win.h" | 43 #include "content/public/app/startup_helper_win.h" |
41 #include "sandbox/win/src/sandbox.h" | 44 #include "sandbox/win/src/sandbox.h" |
42 | 45 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 } | 182 } |
180 | 183 |
181 if (process_type_ == "watcher") { | 184 if (process_type_ == "watcher") { |
182 base::win::ScopedHandle parent_process; | 185 base::win::ScopedHandle parent_process; |
183 base::win::ScopedHandle on_initialized_event; | 186 base::win::ScopedHandle on_initialized_event; |
184 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, | 187 if (!InterpretChromeWatcherCommandLine(cmd_line, &parent_process, |
185 &on_initialized_event)) { | 188 &on_initialized_event)) { |
186 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; | 189 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; |
187 } | 190 } |
188 | 191 |
192 base::FilePath browser_data_directory; | |
grt (UTC plus 2)
2015/02/04 16:42:51
what do you think about making a new chrome path f
| |
193 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, &browser_data_directory)) | |
194 return chrome::RESULT_CODE_MISSING_DATA; | |
195 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
196 browser_data_directory = | |
197 browser_data_directory.Append(dist->GetInstallSubDir()); | |
198 | |
189 // Intentionally leaked. | 199 // Intentionally leaked. |
190 HMODULE watcher_dll = Load(&version, &file); | 200 HMODULE watcher_dll = Load(&version, &file); |
191 if (!watcher_dll) | 201 if (!watcher_dll) |
192 return chrome::RESULT_CODE_MISSING_DATA; | 202 return chrome::RESULT_CODE_MISSING_DATA; |
193 | 203 |
194 ChromeWatcherMainFunction watcher_main = | 204 ChromeWatcherMainFunction watcher_main = |
195 reinterpret_cast<ChromeWatcherMainFunction>( | 205 reinterpret_cast<ChromeWatcherMainFunction>( |
196 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); | 206 ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); |
197 return watcher_main(chrome::kBrowserExitCodesRegistryPath, | 207 return watcher_main(chrome::kBrowserExitCodesRegistryPath, |
198 parent_process.Take(), on_initialized_event.Take()); | 208 parent_process.Take(), on_initialized_event.Take(), |
209 browser_data_directory.value().c_str()); | |
199 } | 210 } |
200 | 211 |
201 // Initialize the sandbox services. | 212 // Initialize the sandbox services. |
202 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 213 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
203 content::InitializeSandboxInfo(&sandbox_info); | 214 content::InitializeSandboxInfo(&sandbox_info); |
204 | 215 |
205 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); | 216 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); |
206 bool exit_now = true; | 217 bool exit_now = true; |
207 if (process_type_.empty()) { | 218 if (process_type_.empty()) { |
208 if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) { | 219 if (breakpad::ShowRestartDialogIfCrashed(&exit_now)) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 } | 302 } |
292 }; | 303 }; |
293 | 304 |
294 MainDllLoader* MakeMainDllLoader() { | 305 MainDllLoader* MakeMainDllLoader() { |
295 #if defined(GOOGLE_CHROME_BUILD) | 306 #if defined(GOOGLE_CHROME_BUILD) |
296 return new ChromeDllLoader(); | 307 return new ChromeDllLoader(); |
297 #else | 308 #else |
298 return new ChromiumDllLoader(); | 309 return new ChromiumDllLoader(); |
299 #endif | 310 #endif |
300 } | 311 } |
OLD | NEW |