| 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 "chrome/app/main_dll_loader_win.h" |
| 6 |
| 5 #include <windows.h> // NOLINT | 7 #include <windows.h> // NOLINT |
| 6 #include <shlwapi.h> // NOLINT | 8 #include <shlwapi.h> // NOLINT |
| 7 #include <stddef.h> | 9 #include <stddef.h> |
| 8 #include <userenv.h> // NOLINT | 10 #include <userenv.h> // NOLINT |
| 9 | 11 |
| 10 #include "chrome/app/main_dll_loader_win.h" | 12 #include <memory> |
| 11 | 13 |
| 12 #include "base/base_paths.h" | 14 #include "base/base_paths.h" |
| 13 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
| 14 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 17 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 18 #include "base/logging.h" | 20 #include "base/logging.h" |
| 19 #include "base/macros.h" | 21 #include "base/macros.h" |
| 20 #include "base/memory/scoped_ptr.h" | |
| 21 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 22 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/trace_event/trace_event.h" | 27 #include "base/trace_event/trace_event.h" |
| 27 #include "base/win/scoped_handle.h" | 28 #include "base/win/scoped_handle.h" |
| 28 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
| 29 #include "chrome/app/chrome_crash_reporter_client.h" | 30 #include "chrome/app/chrome_crash_reporter_client.h" |
| 30 #include "chrome/app/chrome_watcher_client_win.h" | 31 #include "chrome/app/chrome_watcher_client_win.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 //============================================================================= | 206 //============================================================================= |
| 206 | 207 |
| 207 class ChromeDllLoader : public MainDllLoader { | 208 class ChromeDllLoader : public MainDllLoader { |
| 208 protected: | 209 protected: |
| 209 // MainDllLoader implementation. | 210 // MainDllLoader implementation. |
| 210 void OnBeforeLaunch(const std::string& process_type, | 211 void OnBeforeLaunch(const std::string& process_type, |
| 211 const base::FilePath& dll_path) override; | 212 const base::FilePath& dll_path) override; |
| 212 int OnBeforeExit(int return_code, const base::FilePath& dll_path) override; | 213 int OnBeforeExit(int return_code, const base::FilePath& dll_path) override; |
| 213 | 214 |
| 214 private: | 215 private: |
| 215 scoped_ptr<ChromeWatcherClient> chrome_watcher_client_; | 216 std::unique_ptr<ChromeWatcherClient> chrome_watcher_client_; |
| 216 #if BUILDFLAG(ENABLE_KASKO) | 217 #if BUILDFLAG(ENABLE_KASKO) |
| 217 scoped_ptr<KaskoClient> kasko_client_; | 218 std::unique_ptr<KaskoClient> kasko_client_; |
| 218 #endif | 219 #endif |
| 219 }; | 220 }; |
| 220 | 221 |
| 221 void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, | 222 void ChromeDllLoader::OnBeforeLaunch(const std::string& process_type, |
| 222 const base::FilePath& dll_path) { | 223 const base::FilePath& dll_path) { |
| 223 if (process_type.empty()) { | 224 if (process_type.empty()) { |
| 224 RecordDidRun(dll_path); | 225 RecordDidRun(dll_path); |
| 225 | 226 |
| 226 // Launch the watcher process if stats collection consent has been granted. | 227 // Launch the watcher process if stats collection consent has been granted. |
| 227 if (crash_reporter::GetUploadsEnabled()) { | 228 if (crash_reporter::GetUploadsEnabled()) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 292 } |
| 292 }; | 293 }; |
| 293 | 294 |
| 294 MainDllLoader* MakeMainDllLoader() { | 295 MainDllLoader* MakeMainDllLoader() { |
| 295 #if defined(GOOGLE_CHROME_BUILD) | 296 #if defined(GOOGLE_CHROME_BUILD) |
| 296 return new ChromeDllLoader(); | 297 return new ChromeDllLoader(); |
| 297 #else | 298 #else |
| 298 return new ChromiumDllLoader(); | 299 return new ChromiumDllLoader(); |
| 299 #endif | 300 #endif |
| 300 } | 301 } |
| OLD | NEW |