shill: WiFiProvider: Add sketch

The WiFiProvider will be the maintainer of WiFiServices.  It will
be the callee of GetService, and will load all WiFiServices from
Profiles as they are pushed onto the Manager's stack.

BUG=chromium-os:38017
TEST=New unit test

Change-Id: Ide89ff15d19e5d5c56f15906d74ce8ecaf5f3523
Reviewed-on: https://gerrit.chromium.org/gerrit/41605
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/Makefile b/Makefile
index 7835d1d..5574a94 100644
--- a/Makefile
+++ b/Makefile
@@ -296,6 +296,7 @@
 	vpn_service.o \
 	wifi.o \
 	wifi_endpoint.o \
+	wifi_provider.o \
 	wifi_service.o \
 	wimax.o \
 	wimax_device_proxy.o \
@@ -471,6 +472,7 @@
 	vpn_service_unittest.o \
 	vpn_unittest.o \
 	wifi_endpoint_unittest.o \
+	wifi_provider_unittest.o \
 	wifi_service_unittest.o \
 	wifi_unittest.o \
 	wimax_provider_unittest.o \
diff --git a/wifi_provider.cc b/wifi_provider.cc
new file mode 100644
index 0000000..8f0a0cd
--- /dev/null
+++ b/wifi_provider.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/wifi_provider.h"
+
+#include "shill/error.h"
+#include "shill/event_dispatcher.h"
+#include "shill/key_value_store.h"
+#include "shill/manager.h"
+#include "shill/metrics.h"
+#include "shill/wifi_endpoint.h"
+#include "shill/wifi_service.h"
+
+namespace shill {
+
+WiFiProvider::WiFiProvider(ControlInterface *control_interface,
+                           EventDispatcher *dispatcher,
+                           Metrics *metrics,
+                           Manager *manager)
+    : control_interface_(control_interface),
+      dispatcher_(dispatcher),
+      metrics_(metrics),
+      manager_(manager) {}
+
+WiFiProvider::~WiFiProvider() {}
+
+void WiFiProvider::Start() {
+  NOTIMPLEMENTED();
+}
+
+void WiFiProvider::Stop() {
+  NOTIMPLEMENTED();
+}
+
+void WiFiProvider::CreateServicesFromProfile(ProfileRefPtr profile) {
+  NOTIMPLEMENTED();
+}
+
+WiFiServiceRefPtr WiFiProvider::GetService(
+    const KeyValueStore &args, Error *error) {
+  NOTIMPLEMENTED();
+  return NULL;
+}
+
+WiFiServiceRefPtr WiFiProvider::FindServiceForEndpoint(
+    const WiFiEndpoint &endpoint) {
+  NOTIMPLEMENTED();
+  return NULL;
+}
+
+}  // namespace shill
diff --git a/wifi_provider.h b/wifi_provider.h
new file mode 100644
index 0000000..2d5aeea
--- /dev/null
+++ b/wifi_provider.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_WIFI_PROVIDER_
+#define SHILL_WIFI_PROVIDER_
+
+#include "shill/refptr_types.h"
+
+namespace shill {
+
+class ControlInterface;
+class Error;
+class EventDispatcher;
+class KeyValueStore;
+class Manager;
+class Metrics;
+class WiFiEndpoint;
+class WiFiService;
+
+// The WiFi Provider is the holder of all WiFi Services.  It holds both
+// visible (created due to an Endpoint becoming visible) and invisible
+// (created due to user or storage configuration) Services.
+class WiFiProvider {
+ public:
+  WiFiProvider(ControlInterface *control_interface,
+               EventDispatcher *dispatcher,
+               Metrics *metrics,
+               Manager *manager);
+  virtual ~WiFiProvider();
+
+  virtual void Start();
+  virtual void Stop();
+
+  // Called by Manager.
+  void CreateServicesFromProfile(ProfileRefPtr profile);
+  virtual WiFiServiceRefPtr GetService(const KeyValueStore &args, Error *error);
+
+  // Called by WiFi device.
+  WiFiServiceRefPtr FindServiceForEndpoint(const WiFiEndpoint &endpoint);
+
+ private:
+  friend class WiFiProviderTest;
+
+  ControlInterface *control_interface_;
+  EventDispatcher *dispatcher_;
+  Metrics *metrics_;
+  Manager *manager_;
+
+  DISALLOW_COPY_AND_ASSIGN(WiFiProvider);
+};
+
+}  // namespace shill
+
+#endif  // SHILL_WIFI_PROVIDER_
diff --git a/wifi_provider_unittest.cc b/wifi_provider_unittest.cc
new file mode 100644
index 0000000..ccef30e
--- /dev/null
+++ b/wifi_provider_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/wifi_provider.h"
+
+#include <gtest/gtest.h>
+
+#include "shill/mock_manager.h"
+#include "shill/mock_metrics.h"
+#include "shill/nice_mock_control.h"
+
+namespace shill {
+
+class WiFiProviderTest : public testing::Test {
+ public:
+  WiFiProviderTest()
+      : manager_(&control_, NULL, &metrics_, NULL),
+        provider_(&control_, NULL, &metrics_, &manager_) {}
+
+  virtual ~WiFiProviderTest() {}
+
+ protected:
+  NiceMockControl control_;
+  MockMetrics metrics_;
+  MockManager manager_;
+  WiFiProvider provider_;
+};
+
+TEST_F(WiFiProviderTest, Constructor) {
+}
+
+}  // namespace shill