Delete unused downloads page asset.
[chromium-blink-merge.git] / chromecast / app / android / cast_crash_reporter_client_android.cc
blob5bc66ab9e3c192b2f46b77b3e8935aad60dd3d8c
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/app/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/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"
17 namespace chromecast {
19 CastCrashReporterClientAndroid::CastCrashReporterClientAndroid(
20 const std::string& process_type)
21 : process_type_(process_type) {
24 CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() {
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;
38 base::FilePath CastCrashReporterClientAndroid::GetReporterLogFilename() {
39 return base::FilePath(FILE_PATH_LITERAL("uploads.log"));
42 // static
43 bool CastCrashReporterClientAndroid::GetCrashDumpLocation(
44 const std::string& process_type,
45 base::FilePath* crash_dir) {
46 base::FilePath crash_dir_local;
47 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &crash_dir_local)) {
48 return false;
50 crash_dir_local = crash_dir_local.Append("crashes");
52 // Only try to create the directory in the browser process (empty value).
53 if (process_type.empty()) {
54 if (!base::DirectoryExists(crash_dir_local)) {
55 if (!base::CreateDirectory(crash_dir_local)) {
56 return false;
61 // Provide value to crash_dir once directory is known to be a valid path.
62 *crash_dir = crash_dir_local;
63 return true;
66 bool CastCrashReporterClientAndroid::GetCrashDumpLocation(
67 base::FilePath* crash_dir) {
68 return CastCrashReporterClientAndroid::GetCrashDumpLocation(process_type_,
69 crash_dir);
72 size_t CastCrashReporterClientAndroid::RegisterCrashKeys() {
73 return crash_keys::RegisterCastCrashKeys();
76 bool CastCrashReporterClientAndroid::GetCollectStatsConsent() {
77 return android::ChromecastConfigAndroid::GetInstance()->CanSendUsageStats();
80 int CastCrashReporterClientAndroid::GetAndroidMinidumpDescriptor() {
81 return kAndroidMinidumpDescriptor;
84 bool CastCrashReporterClientAndroid::EnableBreakpadForProcess(
85 const std::string& process_type) {
86 return process_type == switches::kRendererProcess ||
87 process_type == switches::kGpuProcess;
90 } // namespace chromecast