base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / chromecast / crash / android / cast_crash_reporter_client_android.cc
blob2137faeea9bfcbca9b9d243efbda5cc4a13c9006
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 "content/public/common/content_switches.h"
16 namespace chromecast {
18 CastCrashReporterClientAndroid::CastCrashReporterClientAndroid() {
21 CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() {
24 void CastCrashReporterClientAndroid::GetProductNameAndVersion(
25 const char** product_name,
26 const char** version) {
27 *product_name = "media_shell";
28 *version = PRODUCT_VERSION
29 #if CAST_IS_DEBUG_BUILD
30 ".debug"
31 #endif
32 "." CAST_BUILD_REVISION;
35 base::FilePath CastCrashReporterClientAndroid::GetReporterLogFilename() {
36 return base::FilePath(FILE_PATH_LITERAL("uploads.log"));
39 bool CastCrashReporterClientAndroid::GetCrashDumpLocation(
40 base::FilePath* crash_dir) {
41 base::FilePath crash_dir_local;
42 if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &crash_dir_local)) {
43 return false;
45 crash_dir_local = crash_dir_local.Append("crashes");
47 if (!base::DirectoryExists(crash_dir_local)) {
48 if (!base::CreateDirectory(crash_dir_local)) {
49 return false;
53 // Provide value to crash_dir once directory is known to be a valid path.
54 *crash_dir = crash_dir_local;
55 return true;
58 bool CastCrashReporterClientAndroid::GetCollectStatsConsent() {
59 return android::ChromecastConfigAndroid::GetInstance()->CanSendUsageStats();
62 int CastCrashReporterClientAndroid::GetAndroidMinidumpDescriptor() {
63 return kAndroidMinidumpDescriptor;
66 bool CastCrashReporterClientAndroid::EnableBreakpadForProcess(
67 const std::string& process_type) {
68 return process_type == switches::kRendererProcess ||
69 process_type == switches::kGpuProcess;
72 } // namespace chromecast