Notify metrics daemon of kernel crashes.

BUG=none
TEST=unit tests, ran crash_reporter --init on the device

Review URL: http://codereview.chromium.org/2847017
diff --git a/crash_reporter/crash_reporter.cc b/crash_reporter/crash_reporter.cc
index 87d4fac..80494cc 100644
--- a/crash_reporter/crash_reporter.cc
+++ b/crash_reporter/crash_reporter.cc
@@ -25,6 +25,7 @@
 static const char kCrashCounterHistogram[] = "Logging.CrashCounter";
 static const char kUncleanShutdownFile[] =
     "/var/lib/crash_reporter/pending_clean_shutdown";
+static const char kEmpty[] = "";
 
 // Enumeration of kinds of crashes to be used in the CrashCounter histogram.
 enum CrashKinds {
@@ -58,13 +59,19 @@
     s_system_log.LogError("Failed to delete unclean shutdown file %s",
                           kUncleanShutdownFile);
   }
+
+  // Touch a file to notify the metrics daemon that a kernel crash has
+  // been detected so that it can log the time since the last kernel
+  // crash.
+  static const char kKernelCrashDetectedFile[] = "/tmp/kernel-crash-detected";
+  FilePath crash_detected(kKernelCrashDetectedFile);
+  file_util::WriteFile(crash_detected, kEmpty, 0);
 }
 
 static bool PrepareUncleanShutdownCheck() {
-  static const char empty[] = "";
   FilePath file_path(kUncleanShutdownFile);
   file_util::CreateDirectory(file_path.DirName());
-  return file_util::WriteFile(file_path, empty, 0) == 0;
+  return file_util::WriteFile(file_path, kEmpty, 0) == 0;
 }
 
 static void SignalCleanShutdown() {
diff --git a/crash_reporter/system_logging_mock.cc b/crash_reporter/system_logging_mock.cc
index 3da1956..a2760e9 100644
--- a/crash_reporter/system_logging_mock.cc
+++ b/crash_reporter/system_logging_mock.cc
@@ -5,7 +5,7 @@
 #include <stdarg.h>
 
 #include "base/string_util.h"
-#include "crash/system_logging_mock.h"
+#include "crash-reporter/system_logging_mock.h"
 
 void SystemLoggingMock::LogInfo(const char *format, ...) {
   va_list vl;