OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "headless/lib/headless_crash_reporter_client.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/command_line.h" |
| 10 #include "base/path_service.h" |
| 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" |
| 14 #include "content/public/common/content_switches.h" |
| 15 #include "headless/public/version.h" |
| 16 |
| 17 namespace headless { |
| 18 |
| 19 HeadlessCrashReporterClient::HeadlessCrashReporterClient() = default; |
| 20 HeadlessCrashReporterClient::~HeadlessCrashReporterClient() = default; |
| 21 |
| 22 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 23 void HeadlessCrashReporterClient::GetProductNameAndVersion( |
| 24 const char** product_name, |
| 25 const char** version) { |
| 26 *product_name = "HeadlessChrome"; |
| 27 *version = PRODUCT_VERSION; |
| 28 } |
| 29 |
| 30 base::FilePath HeadlessCrashReporterClient::GetReporterLogFilename() { |
| 31 return base::FilePath(FILE_PATH_LITERAL("uploads.log")); |
| 32 } |
| 33 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| 34 |
| 35 bool HeadlessCrashReporterClient::GetCrashDumpLocation( |
| 36 #if defined(OS_WIN) |
| 37 base::string16* crash_dir |
| 38 #else |
| 39 base::FilePath* crash_dir |
| 40 #endif |
| 41 ) { |
| 42 base::FilePath crash_directory = crash_dumps_dir_; |
| 43 if (crash_directory.empty() && |
| 44 !base::PathService::Get(base::DIR_MODULE, &crash_directory)) { |
| 45 return false; |
| 46 } |
| 47 #if defined(OS_WIN) |
| 48 *crash_dir = crash_directory.value(); |
| 49 #else |
| 50 *crash_dir = std::move(crash_directory); |
| 51 #endif |
| 52 return true; |
| 53 } |
| 54 |
| 55 bool HeadlessCrashReporterClient::EnableBreakpadForProcess( |
| 56 const std::string& process_type) { |
| 57 return process_type == switches::kRendererProcess || |
| 58 process_type == switches::kPpapiPluginProcess || |
| 59 process_type == switches::kZygoteProcess || |
| 60 process_type == switches::kGpuProcess; |
| 61 } |
| 62 |
| 63 } // namespace content |
OLD | NEW |