diff --git a/handler/handler_main.cc b/handler/handler_main.cc index 80babc31..1cf655ae 100644 --- a/handler/handler_main.cc +++ b/handler/handler_main.cc @@ -168,6 +168,10 @@ void Usage(const base::FilePath& me) { " --minidump-dir-for-tests=TEST_MINIDUMP_DIR\n" " causes /sbin/crash_reporter to leave dumps in\n" " this directory instead of the normal location\n" +" --always-allow-feedback\n" +" pass the --always_allow_feedback flag to\n" +" crash_reporter, thus skipping metrics consent\n" +" checks\n" #endif // OS_CHROMEOS " --help display this help and exit\n" " --version output version information and exit\n", @@ -201,8 +205,9 @@ struct Options { bool rate_limit; bool upload_gzip; #if defined(OS_CHROMEOS) - bool use_cros_crash_reporter; + bool use_cros_crash_reporter = false; base::FilePath minidump_dir_for_tests; + bool always_allow_feedback = false; #endif // OS_CHROMEOS }; @@ -561,6 +566,7 @@ int HandlerMain(int argc, #if defined(OS_CHROMEOS) kOptionUseCrosCrashReporter, kOptionMinidumpDirForTests, + kOptionAlwaysAllowFeedback, #endif // OS_CHROMEOS // Standard options. @@ -636,6 +642,10 @@ int HandlerMain(int argc, required_argument, nullptr, kOptionMinidumpDirForTests}, + {"always-allow-feedback", + no_argument, + nullptr, + kOptionAlwaysAllowFeedback}, #endif // OS_CHROMEOS {"help", no_argument, nullptr, kOptionHelp}, {"version", no_argument, nullptr, kOptionVersion}, @@ -788,6 +798,10 @@ int HandlerMain(int argc, ToolSupport::CommandLineArgumentToFilePathStringType(optarg)); break; } + case kOptionAlwaysAllowFeedback: { + options.always_allow_feedback = true; + break; + } #endif // OS_CHROMEOS case kOptionHelp: { Usage(me); @@ -931,6 +945,10 @@ int HandlerMain(int argc, cros_handler->SetDumpDir(options.minidump_dir_for_tests); } + if (options.always_allow_feedback) { + cros_handler->SetAlwaysAllowFeedback(); + } + exception_handler = std::move(cros_handler); } else { exception_handler = std::make_unique( diff --git a/handler/linux/cros_crash_report_exception_handler.cc b/handler/linux/cros_crash_report_exception_handler.cc index f54cc07c..b394d61f 100644 --- a/handler/linux/cros_crash_report_exception_handler.cc +++ b/handler/linux/cros_crash_report_exception_handler.cc @@ -133,7 +133,8 @@ CrosCrashReportExceptionHandler::CrosCrashReportExceptionHandler( const UserStreamDataSources* user_stream_data_sources) : database_(database), process_annotations_(process_annotations), - user_stream_data_sources_(user_stream_data_sources) {} + user_stream_data_sources_(user_stream_data_sources), + always_allow_feedback_(false) {} CrosCrashReportExceptionHandler::~CrosCrashReportExceptionHandler() = default; @@ -258,6 +259,9 @@ bool CrosCrashReportExceptionHandler::HandleExceptionWithConnection( if (!dump_dir_.empty()) { argv.push_back("--chrome_dump_dir=" + dump_dir_.value()); } + if (always_allow_feedback_) { + argv.push_back("--always_allow_feedback"); + } if (!DoubleForkAndExec(argv, nullptr /* envp */, diff --git a/handler/linux/cros_crash_report_exception_handler.h b/handler/linux/cros_crash_report_exception_handler.h index def1c82b..0b145448 100644 --- a/handler/linux/cros_crash_report_exception_handler.h +++ b/handler/linux/cros_crash_report_exception_handler.h @@ -77,6 +77,7 @@ class CrosCrashReportExceptionHandler UUID* local_report_id = nullptr) override; void SetDumpDir(const base::FilePath& dump_dir) { dump_dir_ = dump_dir; } + void SetAlwaysAllowFeedback() { always_allow_feedback_ = true; } private: bool HandleExceptionWithConnection( PtraceConnection* connection, @@ -90,6 +91,7 @@ class CrosCrashReportExceptionHandler const std::map* process_annotations_; // weak const UserStreamDataSources* user_stream_data_sources_; // weak base::FilePath dump_dir_; + bool always_allow_feedback_; DISALLOW_COPY_AND_ASSIGN(CrosCrashReportExceptionHandler); };