buffet: Add ObjectManager interface to /org/chromium/Buffet

BUG=chromium:359190
TEST=`buffet_client GetManagedObjects` returns
message_type: MESSAGE_METHOD_RETURN
destination: :1.35
sender: :1.31
signature: a{oa{sa{sv}}}
serial: 10
reply_serial: 3

array [
  dict entry {
    object_path "/org/chromium/Buffet/Manager"
    array [
      dict entry {
        string "org.chromium.Buffet.Manager"
        array [
          dict entry {
            string "State"
            variant               string "{}"
          }
        ]
      }
    ]
  }
]

Done.

Change-Id: I2bbcc9a3f71c7ec6ab76cb4600dad7efe1a8bb0a
Reviewed-on: https://chromium-review.googlesource.com/198963
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
diff --git a/buffet/exported_object_manager.h b/buffet/exported_object_manager.h
index e1d8884..d483db0 100644
--- a/buffet/exported_object_manager.h
+++ b/buffet/exported_object_manager.h
@@ -69,14 +69,16 @@
 //     Properties my_properties_;
 //     ExampleObjectManager* object_manager_;
 //   };
-class ExportedObjectManager {
+class ExportedObjectManager
+    : public base::SupportsWeakPtr<ExportedObjectManager> {
  public:
   // Writes a dictionary of property name to property value variants to writer.
   typedef base::Callback<void(dbus::MessageWriter* writer)> PropertyWriter;
   typedef base::Callback<void(bool success)> OnInitFinish;
   typedef std::map<std::string, PropertyWriter> InterfaceProperties;
 
-  ExportedObjectManager(dbus::Bus* bus, const dbus::ObjectPath& path);
+  ExportedObjectManager(scoped_refptr<dbus::Bus> bus,
+                        const dbus::ObjectPath& path);
 
   // Registers methods implementing the ObjectManager interface on the object
   // exported on the path given in the constructor. Must be called on the
@@ -104,9 +106,6 @@
   // Tracks all objects currently known to the ExportedObjectManager.
   std::map<dbus::ObjectPath, InterfaceProperties> registered_objects_;
 
-  // We're going to register DBus callbacks that will outlive ourselves.
-  // These callbacks get scheduled on the origin thread.
-  base::WeakPtrFactory<ExportedObjectManager> weak_ptr_factory_;
   friend class ExportedObjectManagerTest;
   DISALLOW_COPY_AND_ASSIGN(ExportedObjectManager);
 };