Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/app/shell_crash_reporter_client.h" | 5 #include "content/shell/app/shell_crash_reporter_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "content/shell/common/shell_switches.h" | 13 #include "content/shell/common/shell_switches.h" |
| 14 | 14 |
| 15 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 16 #include "content/shell/android/shell_descriptors.h" | 16 #include "content/shell/android/shell_descriptors.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 ShellCrashReporterClient::ShellCrashReporterClient() {} | 21 ShellCrashReporterClient::ShellCrashReporterClient() {} |
| 22 ShellCrashReporterClient::~ShellCrashReporterClient() {} | 22 ShellCrashReporterClient::~ShellCrashReporterClient() {} |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 void ShellCrashReporterClient::GetProductNameAndVersion( | 25 void ShellCrashReporterClient::GetProductNameAndVersion( |
| 26 const base::FilePath& exe_path, | 26 const base::string16& exe_path, |
| 27 base::string16* product_name, | 27 base::string16* product_name, |
| 28 base::string16* version, | 28 base::string16* version, |
| 29 base::string16* special_build, | 29 base::string16* special_build, |
| 30 base::string16* channel_name) { | 30 base::string16* channel_name) { |
| 31 *product_name = base::ASCIIToUTF16("content_shell"); | 31 *product_name = base::ASCIIToUTF16("content_shell"); |
| 32 *version = base::ASCIIToUTF16(CONTENT_SHELL_VERSION); | 32 *version = base::ASCIIToUTF16(CONTENT_SHELL_VERSION); |
| 33 *special_build = base::string16(); | 33 *special_build = base::string16(); |
| 34 *channel_name = base::string16(); | 34 *channel_name = base::string16(); |
| 35 } | 35 } |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 38 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 39 void ShellCrashReporterClient::GetProductNameAndVersion( | 39 void ShellCrashReporterClient::GetProductNameAndVersion( |
| 40 const char** product_name, | 40 const char** product_name, |
| 41 const char** version) { | 41 const char** version) { |
| 42 *product_name = "content_shell"; | 42 *product_name = "content_shell"; |
| 43 *version = CONTENT_SHELL_VERSION; | 43 *version = CONTENT_SHELL_VERSION; |
| 44 } | 44 } |
| 45 | 45 |
| 46 base::FilePath ShellCrashReporterClient::GetReporterLogFilename() { | 46 base::FilePath ShellCrashReporterClient::GetReporterLogFilename() { |
| 47 return base::FilePath(FILE_PATH_LITERAL("uploads.log")); | 47 return base::FilePath(FILE_PATH_LITERAL("uploads.log")); |
| 48 } | 48 } |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if defined(OS_WIN) | |
| 52 bool ShellCrashReporterClient::GetCrashDumpLocation(base::string16* crash_dir) { | |
| 53 #else | |
| 51 bool ShellCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) { | 54 bool ShellCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) { |
| 55 #endif | |
| 52 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 56 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 53 switches::kCrashDumpsDir)) | 57 switches::kCrashDumpsDir)) |
| 54 return false; | 58 return false; |
| 55 *crash_dir = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 59 base::FilePath crash_directory = |
| 56 switches::kCrashDumpsDir); | 60 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 61 switches::kCrashDumpsDir); | |
| 62 #if defined(OS_WIN) | |
| 63 *crash_dir = crash_directory.value(); | |
| 64 #else | |
| 65 *crash_dir = crash_directory; | |
|
grt (UTC plus 2)
2016/06/02 12:55:33
#include <utility>
*crash_dir = std::move(crash_d
ananta
2016/06/02 20:34:20
Done. Left the OS_WIN part as is
| |
| 66 #endif | |
| 57 return true; | 67 return true; |
| 58 } | 68 } |
| 59 | 69 |
| 60 #if defined(OS_ANDROID) | 70 #if defined(OS_ANDROID) |
| 61 int ShellCrashReporterClient::GetAndroidMinidumpDescriptor() { | 71 int ShellCrashReporterClient::GetAndroidMinidumpDescriptor() { |
| 62 return kAndroidMinidumpDescriptor; | 72 return kAndroidMinidumpDescriptor; |
| 63 } | 73 } |
| 64 #endif | 74 #endif |
| 65 | 75 |
| 66 bool ShellCrashReporterClient::EnableBreakpadForProcess( | 76 bool ShellCrashReporterClient::EnableBreakpadForProcess( |
| 67 const std::string& process_type) { | 77 const std::string& process_type) { |
| 68 return process_type == switches::kRendererProcess || | 78 return process_type == switches::kRendererProcess || |
| 69 process_type == switches::kPpapiPluginProcess || | 79 process_type == switches::kPpapiPluginProcess || |
| 70 process_type == switches::kZygoteProcess || | 80 process_type == switches::kZygoteProcess || |
| 71 process_type == switches::kGpuProcess; | 81 process_type == switches::kGpuProcess; |
| 72 } | 82 } |
| 73 | 83 |
| 74 } // namespace content | 84 } // namespace content |
| OLD | NEW |