Crash component: adds API for clients to handle the crash minidump.

R=rsesek@chromium.org
BUG=422613

Review URL: https://codereview.chromium.org/692093005

Cr-Commit-Position: refs/heads/master@{#302849}
diff --git a/components/crash/app/breakpad_linux.cc b/components/crash/app/breakpad_linux.cc
index 4fe127b9..6c862200 100644
--- a/components/crash/app/breakpad_linux.cc
+++ b/components/crash/app/breakpad_linux.cc
@@ -1191,6 +1191,10 @@
   google_breakpad::PageAllocator allocator;
   const char* exe_buf = NULL;
 
+  if (GetCrashReporterClient()->HandleCrashDump(info.filename)) {
+    return;
+  }
+
 #if defined(OS_CHROMEOS)
   // Grab the crashing process' name now, when it should still be available.
   // If we try to do this later in our grandchild the crashing process has
diff --git a/components/crash/app/crash_reporter_client.cc b/components/crash/app/crash_reporter_client.cc
index 4f9fd92..cf479b91 100644
--- a/components/crash/app/crash_reporter_client.cc
+++ b/components/crash/app/crash_reporter_client.cc
@@ -86,6 +86,10 @@
 base::FilePath CrashReporterClient::GetReporterLogFilename() {
   return base::FilePath();
 }
+
+bool CrashReporterClient::HandleCrashDump(const char* crashdump_filename) {
+  return false;
+}
 #endif
 
 bool CrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
diff --git a/components/crash/app/crash_reporter_client.h b/components/crash/app/crash_reporter_client.h
index 4032bd1..3a580b7 100644
--- a/components/crash/app/crash_reporter_client.h
+++ b/components/crash/app/crash_reporter_client.h
@@ -103,6 +103,13 @@
                                         const char** version);
 
   virtual base::FilePath GetReporterLogFilename();
+
+  // Custom crash minidump handler after the minidump is generated.
+  // Returns true if the minidump is handled (client); otherwise, return false
+  // to fallback to default handler.
+  // WARNING: this handler runs in a compromised context. It may not call into
+  // libc nor allocate memory normally.
+  virtual bool HandleCrashDump(const char* crashdump_filename);
 #endif
 
   // The location where minidump files should be written. Returns true if