146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// found in the LICENSE file.
446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "chrome/browser/local_discovery/wifi/wifi_manager.h"
646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)namespace local_discovery {
846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)namespace wifi {
1046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
1146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)namespace {
1246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
1346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)WifiManagerFactory* g_factory = NULL;
1446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
1546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}  // namespace
1646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
1746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)scoped_ptr<WifiManager> WifiManager::Create() {
1846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  if (g_factory) {
1946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    return g_factory->CreateWifiManager();
2046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
2146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  return CreateDefault();
2346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
2446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void WifiManager::SetFactory(WifiManagerFactory* factory) {
2646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  g_factory = factory;
2746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
2846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)WifiCredentials WifiCredentials::FromPSK(const std::string& psk) {
3046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  WifiCredentials return_value;
3146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  return_value.psk = psk;
3246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  return return_value;
3346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
3446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
3546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}  // namespace wifi
3646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
3746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}  // namespace local_discovery
38