metrics: Add guest mode detection to metrics library and client

Change-Id: I2c27bd999330395ba3568820ea76198b202bd7f4

BUG=7203
TEST=Verify metrics_client -c and -g toggling consent and guest mode.

Review URL: http://codereview.chromium.org/3571009
diff --git a/metrics/metrics_library.h b/metrics/metrics_library.h
index 52da94d..fb31c20 100644
--- a/metrics/metrics_library.h
+++ b/metrics/metrics_library.h
@@ -27,6 +27,9 @@
   // Initializes the library.
   void Init();
 
+  // Returns whether or not the machine is running in guest mode.
+  bool IsGuestMode();
+
   // Returns whether or not metrics collection is enabled.
   bool AreMetricsEnabled();
 
@@ -75,9 +78,18 @@
   FRIEND_TEST(MetricsLibraryTest, AreMetricsEnabled);
   FRIEND_TEST(MetricsLibraryTest, FormatChromeMessage);
   FRIEND_TEST(MetricsLibraryTest, FormatChromeMessageTooLong);
+  FRIEND_TEST(MetricsLibraryTest, IsDeviceMounted);
   FRIEND_TEST(MetricsLibraryTest, SendMessageToChrome);
   FRIEND_TEST(MetricsLibraryTest, SendMessageToChromeUMAEventsBadFileLocation);
 
+  // Sets |*result| to whether or not the |mounts_file| indicates that
+  // the |device_name| is currently mounted.  Uses |buffer| of
+  // |buffer_size| to read the file.  Returns false if any error.
+  bool IsDeviceMounted(const char* device_name,
+                       const char* mounts_file,
+                       char* buffer, int buffer_size,
+                       bool* result);
+
   // Sends message of size |length| to Chrome for transport to UMA and
   // returns true on success.
   bool SendMessageToChrome(int32_t length, const char* message);