Roll libvpx 861f35:1fff3e
[chromium-blink-merge.git] / chromecast / crash / android / cast_crash_reporter_client_android.cc
blob41717f892f8addde369c70fc0e0f8cb04b330ebf
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.
5 #include "chromecast/crash/android/cast_crash_reporter_client_android.h"
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/android/chromecast_config_android.h"
12 #include "chromecast/common/global_descriptors.h"
13 #include "chromecast/common/version.h"
14 #include "chromecast/crash/cast_crash_keys.h"
15 #include "content/public/common/content_switches.h"
17 namespace chromecast {
19 CastCrashReporterClientAndroid::CastCrashReporterClientAndroid() {
22 CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() {
25 void CastCrashReporterClientAndroid::GetProductNameAndVersion(
26 const char** product_name,
27 const char** version) {
28 *product_name = "media_shell";
29 *version = PRODUCT_VERSION
30 #if CAST_IS_DEBUG_BUILD
31 ".debug"
32 #endif
33 "." CAST_BUILD_REVISION;
36 base::FilePath CastCrashReporterClientAndroid::GetReporterLogFilename() {
37 return base::FilePath(FILE_PATH_LITERAL("uploads.log"));
40 bool CastCrashReporterClientAndroid::GetCrashDumpLocation(
41 base::FilePath* crash_dir) {
42 base::FilePath crash_dir_local;
43 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &crash_dir_local)) {
44 return false;
46 crash_dir_local = crash_dir_local.Append("crashes");
48 if (!base::DirectoryExists(crash_dir_local)) {
49 if (!base::CreateDirectory(crash_dir_local)) {
50 return false;
54 // Provide value to crash_dir once directory is known to be a valid path.
55 *crash_dir = crash_dir_local;
56 return true;
59 size_t CastCrashReporterClientAndroid::RegisterCrashKeys() {
60 return crash_keys::RegisterCastCrashKeys();
63 bool CastCrashReporterClientAndroid::GetCollectStatsConsent() {
64 return android::ChromecastConfigAndroid::GetInstance()->CanSendUsageStats();
67 int CastCrashReporterClientAndroid::GetAndroidMinidumpDescriptor() {
68 return kAndroidMinidumpDescriptor;
71 bool CastCrashReporterClientAndroid::EnableBreakpadForProcess(
72 const std::string& process_type) {
73 return process_type == switches::kRendererProcess ||
74 process_type == switches::kGpuProcess;
77 } // namespace chromecast