| 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>  // NOLINT |    5 #include <windows.h>  // NOLINT | 
|    6 #include <shlwapi.h>  // NOLINT |    6 #include <shlwapi.h>  // NOLINT | 
|    7 #include <stddef.h> |    7 #include <stddef.h> | 
|    8 #include <userenv.h>  // NOLINT |    8 #include <userenv.h>  // NOLINT | 
|    9  |    9  | 
|   10 #include "chrome/app/main_dll_loader_win.h" |   10 #include "chrome/app/main_dll_loader_win.h" | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|   39 #include "chrome/installer/util/google_update_constants.h" |   39 #include "chrome/installer/util/google_update_constants.h" | 
|   40 #include "chrome/installer/util/google_update_settings.h" |   40 #include "chrome/installer/util/google_update_settings.h" | 
|   41 #include "chrome/installer/util/install_util.h" |   41 #include "chrome/installer/util/install_util.h" | 
|   42 #include "chrome/installer/util/module_util_win.h" |   42 #include "chrome/installer/util/module_util_win.h" | 
|   43 #include "chrome/installer/util/util_constants.h" |   43 #include "chrome/installer/util/util_constants.h" | 
|   44 #include "components/crash/content/app/crash_reporter_client.h" |   44 #include "components/crash/content/app/crash_reporter_client.h" | 
|   45 #include "components/crash/content/app/crashpad.h" |   45 #include "components/crash/content/app/crashpad.h" | 
|   46 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
     h" |   46 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
     h" | 
|   47 #include "content/public/app/sandbox_helper_win.h" |   47 #include "content/public/app/sandbox_helper_win.h" | 
|   48 #include "content/public/common/content_switches.h" |   48 #include "content/public/common/content_switches.h" | 
|   49 #include "sandbox/win/src/sandbox.h" |   49  | 
 |   50 namespace sandbox { | 
 |   51  | 
 |   52 // Contains the pointer to a target or broker service. | 
 |   53 struct SandboxInterfaceInfo { | 
 |   54   void* broker_services; | 
 |   55   void* target_services; | 
 |   56 }; | 
 |   57  | 
 |   58 }  // namespace sandbox | 
|   50  |   59  | 
|   51 namespace { |   60 namespace { | 
|   52 // The entry point signature of chrome.dll. |   61 // The entry point signature of chrome.dll. | 
|   53 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); |   62 typedef int (*DLL_MAIN)(HINSTANCE, sandbox::SandboxInterfaceInfo*); | 
|   54  |   63  | 
|   55 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); |   64 typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); | 
|   56  |   65  | 
|   57 // Loads |module| after setting the CWD to |module|'s directory. Returns a |   66 // Loads |module| after setting the CWD to |module|'s directory. Returns a | 
|   58 // reference to the loaded module on success, or null on error. |   67 // reference to the loaded module on success, or null on error. | 
|   59 HMODULE LoadModuleWithDirectory(const base::FilePath& module) { |   68 HMODULE LoadModuleWithDirectory(const base::FilePath& module) { | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  164         reinterpret_cast<ChromeWatcherMainFunction>( |  173         reinterpret_cast<ChromeWatcherMainFunction>( | 
|  165             ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); |  174             ::GetProcAddress(watcher_dll, kChromeWatcherDLLEntrypoint)); | 
|  166     return watcher_main( |  175     return watcher_main( | 
|  167         chrome::kBrowserExitCodesRegistryPath, parent_process.Take(), |  176         chrome::kBrowserExitCodesRegistryPath, parent_process.Take(), | 
|  168         main_thread_id, on_initialized_event.Take(), |  177         main_thread_id, on_initialized_event.Take(), | 
|  169         watcher_data_directory.value().c_str(), channel_name.c_str()); |  178         watcher_data_directory.value().c_str(), channel_name.c_str()); | 
|  170   } |  179   } | 
|  171  |  180  | 
|  172   // Initialize the sandbox services. |  181   // Initialize the sandbox services. | 
|  173   sandbox::SandboxInterfaceInfo sandbox_info = {0}; |  182   sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 
|  174   content::InitializeSandboxInfo(&sandbox_info); |  | 
|  175  |  183  | 
|  176   dll_ = Load(&file); |  184   dll_ = Load(&file); | 
|  177   if (!dll_) |  185   if (!dll_) | 
|  178     return chrome::RESULT_CODE_MISSING_DATA; |  186     return chrome::RESULT_CODE_MISSING_DATA; | 
|  179  |  187  | 
|  180   OnBeforeLaunch(process_type_, file); |  188   OnBeforeLaunch(process_type_, file); | 
|  181   DLL_MAIN chrome_main = |  189   DLL_MAIN chrome_main = | 
|  182       reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); |  190       reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll_, "ChromeMain")); | 
|  183   int rc = chrome_main(instance, &sandbox_info); |  191   int rc = chrome_main(instance, &sandbox_info); | 
|  184   rc = OnBeforeExit(rc, file); |  192   rc = OnBeforeExit(rc, file); | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  296   } |  304   } | 
|  297 }; |  305 }; | 
|  298  |  306  | 
|  299 MainDllLoader* MakeMainDllLoader() { |  307 MainDllLoader* MakeMainDllLoader() { | 
|  300 #if defined(GOOGLE_CHROME_BUILD) |  308 #if defined(GOOGLE_CHROME_BUILD) | 
|  301   return new ChromeDllLoader(); |  309   return new ChromeDllLoader(); | 
|  302 #else |  310 #else | 
|  303   return new ChromiumDllLoader(); |  311   return new ChromiumDllLoader(); | 
|  304 #endif |  312 #endif | 
|  305 } |  313 } | 
| OLD | NEW |