[shill] Use ref-counted pointers more, break unneeded header deps

1) Replace more bare pointers with ref-counted pointers.
2) Move declarations of *RefPtr into a header file with fwd-declared classes
3) Make class headers include that, move inclusion of real headers to .cc files.

BUG=None
TEST=unit tests

Change-Id: I8208c82377c6dbefe6903561a503b8db63f063d6
Reviewed-on: http://gerrit.chromium.org/gerrit/3177
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/device.h b/device.h
index b8fa675..ef75711 100644
--- a/device.h
+++ b/device.h
@@ -13,16 +13,14 @@
 #include <base/memory/scoped_ptr.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
-#include "shill/device_config_interface.h"
 #include "shill/ipconfig.h"
 #include "shill/property_store.h"
-#include "shill/service.h"
+#include "shill/refptr_types.h"
 #include "shill/shill_event.h"
 
 namespace shill {
 
 class ControlInterface;
-class Device;
 class DeviceAdaptorInterface;
 class DeviceInfo;
 class Endpoint;
@@ -30,14 +28,9 @@
 class EventDispatcher;
 class Manager;
 
-typedef scoped_refptr<const Device> DeviceConstRefPtr;
-typedef scoped_refptr<Device> DeviceRefPtr;
-
 // Device superclass.  Individual network interfaces types will inherit from
 // this class.
-// DeviceConfigInterface is RefCounted, so this class and derived classes
-// are as well.
-class Device : public DeviceConfigInterface, public PropertyStore {
+class Device : public base::RefCounted<Device>, public PropertyStore {
  public:
   enum Technology {
     kEthernet,
@@ -65,7 +58,6 @@
   virtual void LinkEvent(unsigned flags, unsigned change);
   virtual void Scan();
 
-  // Implementation of DeviceConfigInterface
   virtual void ConfigIP() {}
 
   // Implementation of PropertyStore
@@ -122,7 +114,7 @@
   friend class DeviceAdaptorInterface;
 
   // Callback invoked on every IP configuration update.
-  void IPConfigUpdatedCallback(IPConfigRefPtr ipconfig, bool success);
+  void IPConfigUpdatedCallback(const IPConfigRefPtr &ipconfig, bool success);
 
   const std::string link_name_;
   scoped_ptr<DeviceAdaptorInterface> adaptor_;