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