[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/wifi.h b/wifi.h
index 3d2f2d7..21a66cc 100644
--- a/wifi.h
+++ b/wifi.h
@@ -10,16 +10,14 @@
 #include <vector>
 
 #include "shill/device.h"
+#include "shill/refptr_types.h"
 #include "shill/shill_event.h"
 #include "shill/supplicant-process.h"
 #include "shill/supplicant-interface.h"
 
 namespace shill {
 
-class WiFiEndpoint;
 class WiFiService;
-typedef scoped_refptr<const WiFiEndpoint> WiFiEndpointConstRefPtr;
-typedef scoped_refptr<WiFiEndpoint> WiFiEndpointRefPtr;
 
 // WiFi class. Specialization of Device for WiFi.
 class WiFi : public Device {
@@ -72,7 +70,8 @@
       private ::DBus::ObjectProxy  // used by dbus-c++, not WiFi
   {
    public:
-    SupplicantInterfaceProxy(WiFi *wifi, DBus::Connection *bus,
+    SupplicantInterfaceProxy(const WiFiRefPtr &wifi,
+                             DBus::Connection *bus,
                              const ::DBus::Path &object_path);
 
    private:
@@ -94,7 +93,7 @@
     virtual void PropertiesChanged(const std::map<std::string, ::DBus::Variant>
                                    &properties);
 
-    WiFi &wifi_;
+    WiFiRefPtr wifi_;
   };
 
   typedef std::map<const std::string, WiFiEndpointRefPtr> EndpointMap;