debugd: Use cromo and ModemManager DBus service constants.

BUG=None
CQ-DEPEND=CL:199602
CQ-DEPEND=CL:199609
TEST=Tested the following:
1. Build and run unit tests.
2. Run the command below in a root shell:

   dbus-send --system --print-reply --dest=org.chromium.debugd \
       /org/chromium/debugd org.chromium.debugd.SetDebugMode \
       string:cellular

   dbus-send --system --print-reply --dest=org.chromium.debugd \
       /org/chromium/debugd org.chromium.debugd.GetModemStatus

Change-Id: I505d38c639a70652a6ed59ea9f1bba1c058c37c8
Reviewed-on: https://chromium-review.googlesource.com/199666
Reviewed-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/src/debug_mode_tool.cc b/src/debug_mode_tool.cc
index cbc3b19..c7d784e 100644
--- a/src/debug_mode_tool.cc
+++ b/src/debug_mode_tool.cc
@@ -5,6 +5,7 @@
 #include "debug_mode_tool.h"
 
 #include <base/file_util.h>
+#include <chromeos/dbus/service_constants.h>
 
 #include "shill/dbus_proxies/org.chromium.flimflam.Manager.h"
 #include "dbus_proxies/org.freedesktop.DBus.Properties.h"
@@ -43,12 +44,6 @@
 
 const char* const kModemManager = "ModemManager";
 
-const char* const kCromoModemManagerPath = "/org/chromium/ModemManager";
-const char* const kCromoModemManagerService = "org.chromium.ModemManager";
-
-const char* const kModemManager1Path = "/org/freedesktop/ModemManager1";
-const char* const kModemManager1Service = "org.freedesktop.ModemManager1";
-
 class ModemManagerProxy
     : public org::freedesktop::ModemManager_proxy,
       public DBus::ObjectProxy {
@@ -144,13 +139,15 @@
   GetAllModemManagers(&managers);
   for (size_t i = 0; i < managers.size(); ++i) {
     const std::string& manager = managers[i];
-    if (manager == kCromoModemManagerService) {
-      ModemManagerProxy modemmanager(connection_, kCromoModemManagerPath,
-                                     kCromoModemManagerService);
+    if (manager == cromo::kCromoServiceName) {
+      ModemManagerProxy modemmanager(connection_,
+                                     cromo::kCromoServicePath,
+                                     cromo::kCromoServiceName);
       modemmanager.SetLogging(level == "err" ? "error" : level);
-    } else if (manager == kModemManager1Service) {
-      ModemManager1Proxy modemmanager(connection_, kModemManager1Path,
-                                      kModemManager1Service);
+    } else if (manager == modemmanager::kModemManager1ServiceName) {
+      ModemManager1Proxy modemmanager(connection_,
+                                      modemmanager::kModemManager1ServicePath,
+                                      modemmanager::kModemManager1ServiceName);
       modemmanager.SetLogging(level);
     }
   }
diff --git a/src/helpers/modem_status.cc b/src/helpers/modem_status.cc
index 8704684..a556195 100644
--- a/src/helpers/modem_status.cc
+++ b/src/helpers/modem_status.cc
@@ -8,6 +8,7 @@
 #include <base/json/json_writer.h>
 #include <base/strings/string_util.h>
 #include <base/values.h>
+#include <chromeos/dbus/service_constants.h>
 #include <chromeos/utility.h>
 
 #include "dbus_proxies/org.freedesktop.DBus.Properties.h"
@@ -24,20 +25,6 @@
 // TODO(ellyjones): fix that
 const uint32_t kModemTypeGsm = 1;
 
-const char* kCromoPath = "/org/chromium/ModemManager";
-const char* kCromoService = "org.chromium.ModemManager";
-
-const char* kModemInterface = "org.freedesktop.ModemManager.Modem";
-const char* kModemSimpleInterface = "org.freedesktop.ModemManager.Modem.Simple";
-const char* kModemCdmaInterface = "org.freedesktop.ModemManager.Modem.Cdma";
-const char* kModemGsmInterface = "org.freedesktop.ModemManager.Modem.Gsm";
-const char* kModemGsmCardInterface =
-    "org.freedesktop.ModemManager.Modem.Gsm.Card";
-const char* kModemGsmNetworkInterface =
-    "org.freedesktop.ModemManager.Modem.Gsm.Network";
-const char* kModemGobiInterface =
-    "org.chromium.ModemManager.Modem.Gobi";
-
 class DBusPropertiesProxy
     : public org::freedesktop::DBus::Properties_proxy,
       public DBus::ObjectProxy {
@@ -139,15 +126,15 @@
   DictionaryValue* props = new DictionaryValue();
   DBusPropertiesProxy properties = DBusPropertiesProxy(conn, path_.c_str(),
                                                        service_);
-  FetchOneInterface(properties, kModemInterface, props);
-  FetchOneInterface(properties, kModemSimpleInterface, props);
+  FetchOneInterface(properties, cromo::kModemInterface, props);
+  FetchOneInterface(properties, cromo::kModemSimpleInterface, props);
   uint32_t type = modem.Type();
   if (type == kModemTypeGsm) {
-    FetchOneInterface(properties, kModemGsmInterface, props);
-    FetchOneInterface(properties, kModemGsmCardInterface, props);
-    FetchOneInterface(properties, kModemGsmNetworkInterface, props);
+    FetchOneInterface(properties, cromo::kModemGsmInterface, props);
+    FetchOneInterface(properties, cromo::kModemGsmCardInterface, props);
+    FetchOneInterface(properties, cromo::kModemGsmNetworkInterface, props);
   } else {
-    FetchOneInterface(properties, kModemCdmaInterface, props);
+    FetchOneInterface(properties, cromo::kModemCdmaInterface, props);
   }
   result->Set("properties", props);
 
@@ -158,7 +145,9 @@
   DBus::BusDispatcher dispatcher;
   DBus::default_dispatcher = &dispatcher;
   DBus::Connection conn = DBus::Connection::SystemBus();
-  ModemManagerProxy cromo(conn, kCromoPath, kCromoService);
+  ModemManagerProxy cromo(conn,
+                          cromo::kCromoServicePath,
+                          cromo::kCromoServiceName);
   std::vector<Modem> modems;
 
   // The try-catch block is to account for cromo not being present.
@@ -167,7 +156,7 @@
   try {
     std::vector<DBus::Path> cromo_modems = cromo.EnumerateDevices();
     for (size_t i = 0; i < cromo_modems.size(); ++i)
-      modems.push_back(Modem(kCromoService, cromo_modems[i]));
+      modems.push_back(Modem(cromo::kCromoServiceName, cromo_modems[i]));
     // cpplint thinks this is a function call
   } catch(DBus::Error e) { }