1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_NETWORK_SWITCHER_H_ 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_NETWORK_SWITCHER_H_ 7 8 #include <string> 9 10 #include "base/callback.h" 11 #include "base/memory/weak_ptr.h" 12 #include "chrome/browser/local_discovery/wifi/wifi_manager.h" 13 14 namespace local_discovery { 15 16 namespace wifi { 17 18 class BootstrappingNetworkSwitcher { 19 public: 20 typedef base::Callback<void(bool success)> SuccessCallback; 21 22 BootstrappingNetworkSwitcher(WifiManager* wifi_manager, 23 const std::string& connect_ssid, 24 const SuccessCallback& callback); 25 ~BootstrappingNetworkSwitcher(); 26 27 void Connect(); 28 29 void Disconnect(); 30 31 private: 32 void OnGotNetworkList(const NetworkPropertiesList& networks); 33 34 void OnConnectStatus(bool status); 35 36 WifiManager* wifi_manager_; 37 std::string connect_ssid_; 38 SuccessCallback callback_; 39 40 std::string return_guid_; 41 bool connected_; 42 43 base::WeakPtrFactory<BootstrappingNetworkSwitcher> weak_factory_; 44 }; 45 46 } // namespace wifi 47 48 } // namespace local_discovery 49 50 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_NETWORK_SWITCHER_H_ 51