| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 "chromecast/crash/android/cast_crash_reporter_client_android.h" | |
| 6 | |
| 7 #include "base/base_paths.h" | |
| 8 #include "base/files/file_path.h" | |
| 9 #include "base/files/file_util.h" | |
| 10 #include "base/path_service.h" | |
| 11 #include "chromecast/base/chromecast_config_android.h" | |
| 12 #include "chromecast/base/version.h" | |
| 13 #include "chromecast/common/global_descriptors.h" | |
| 14 #include "chromecast/crash/cast_crash_keys.h" | |
| 15 #include "content/public/common/content_switches.h" | |
| 16 | |
| 17 namespace chromecast { | |
| 18 | |
| 19 CastCrashReporterClientAndroid::CastCrashReporterClientAndroid( | |
| 20 const std::string& process_type) | |
| 21 : process_type_(process_type) { | |
| 22 } | |
| 23 | |
| 24 CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() { | |
| 25 } | |
| 26 | |
| 27 void CastCrashReporterClientAndroid::GetProductNameAndVersion( | |
| 28 const char** product_name, | |
| 29 const char** version) { | |
| 30 *product_name = "media_shell"; | |
| 31 *version = PRODUCT_VERSION | |
| 32 #if CAST_IS_DEBUG_BUILD() | |
| 33 ".debug" | |
| 34 #endif | |
| 35 "." CAST_BUILD_REVISION; | |
| 36 } | |
| 37 | |
| 38 base::FilePath CastCrashReporterClientAndroid::GetReporterLogFilename() { | |
| 39 return base::FilePath(FILE_PATH_LITERAL("uploads.log")); | |
| 40 } | |
| 41 | |
| 42 bool CastCrashReporterClientAndroid::GetCrashDumpLocation( | |
| 43 base::FilePath* crash_dir) { | |
| 44 base::FilePath crash_dir_local; | |
| 45 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &crash_dir_local)) { | |
| 46 return false; | |
| 47 } | |
| 48 crash_dir_local = crash_dir_local.Append("crashes"); | |
| 49 | |
| 50 // Only try to create the directory in the browser process (empty value). | |
| 51 if (process_type_.empty()) { | |
| 52 if (!base::DirectoryExists(crash_dir_local)) { | |
| 53 if (!base::CreateDirectory(crash_dir_local)) { | |
| 54 return false; | |
| 55 } | |
| 56 } | |
| 57 } | |
| 58 | |
| 59 // Provide value to crash_dir once directory is known to be a valid path. | |
| 60 *crash_dir = crash_dir_local; | |
| 61 return true; | |
| 62 } | |
| 63 | |
| 64 size_t CastCrashReporterClientAndroid::RegisterCrashKeys() { | |
| 65 return crash_keys::RegisterCastCrashKeys(); | |
| 66 } | |
| 67 | |
| 68 bool CastCrashReporterClientAndroid::GetCollectStatsConsent() { | |
| 69 return android::ChromecastConfigAndroid::GetInstance()->CanSendUsageStats(); | |
| 70 } | |
| 71 | |
| 72 int CastCrashReporterClientAndroid::GetAndroidMinidumpDescriptor() { | |
| 73 return kAndroidMinidumpDescriptor; | |
| 74 } | |
| 75 | |
| 76 bool CastCrashReporterClientAndroid::EnableBreakpadForProcess( | |
| 77 const std::string& process_type) { | |
| 78 return process_type == switches::kRendererProcess || | |
| 79 process_type == switches::kGpuProcess; | |
| 80 } | |
| 81 | |
| 82 } // namespace chromecast | |
| OLD | NEW |