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 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
54 switches::kCrashDumpsDir)) | |
55 return false; | |
56 *crash_dir = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | |
57 switches::kCrashDumpsDir).value(); | |
58 return true; | |
59 } | |
60 #else | |
51 bool ShellCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) { | 61 bool ShellCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) { |
52 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 62 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
53 switches::kCrashDumpsDir)) | 63 switches::kCrashDumpsDir)) |
54 return false; | 64 return false; |
55 *crash_dir = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 65 *crash_dir = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
56 switches::kCrashDumpsDir); | 66 switches::kCrashDumpsDir); |
scottmg
2016/06/02 00:09:30
can you just #if the signature and the .value() in
ananta
2016/06/02 00:22:57
Done.
| |
57 return true; | 67 return true; |
58 } | 68 } |
69 #endif | |
59 | 70 |
60 #if defined(OS_ANDROID) | 71 #if defined(OS_ANDROID) |
61 int ShellCrashReporterClient::GetAndroidMinidumpDescriptor() { | 72 int ShellCrashReporterClient::GetAndroidMinidumpDescriptor() { |
62 return kAndroidMinidumpDescriptor; | 73 return kAndroidMinidumpDescriptor; |
63 } | 74 } |
64 #endif | 75 #endif |
65 | 76 |
66 bool ShellCrashReporterClient::EnableBreakpadForProcess( | 77 bool ShellCrashReporterClient::EnableBreakpadForProcess( |
67 const std::string& process_type) { | 78 const std::string& process_type) { |
68 return process_type == switches::kRendererProcess || | 79 return process_type == switches::kRendererProcess || |
69 process_type == switches::kPpapiPluginProcess || | 80 process_type == switches::kPpapiPluginProcess || |
70 process_type == switches::kZygoteProcess || | 81 process_type == switches::kZygoteProcess || |
71 process_type == switches::kGpuProcess; | 82 process_type == switches::kGpuProcess; |
72 } | 83 } |
73 | 84 |
74 } // namespace content | 85 } // namespace content |
OLD | NEW |