Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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_WIFI_MANAGER_NONCHROMEOS_H_ | |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_NONCHROMEOS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/observer_list.h" | |
| 15 #include "chrome/browser/local_discovery/wifi/wifi_manager.h" | |
| 16 #include "content/public/browser/browser_thread.h" | |
| 17 | |
| 18 namespace local_discovery { | |
| 19 | |
| 20 namespace wifi { | |
| 21 | |
| 22 class WifiManagerNonChromeos : public WifiManager { | |
| 23 public: | |
| 24 WifiManagerNonChromeos(); | |
| 25 virtual ~WifiManagerNonChromeos(); | |
| 26 | |
| 27 // WifiManager implementation. | |
| 28 virtual void Start() OVERRIDE; | |
| 29 virtual void GetSSIDList(const SSIDListCallback& callback) OVERRIDE; | |
| 30 virtual void RequestScan() OVERRIDE; | |
| 31 virtual void ConfigureAndConnectNetwork( | |
| 32 const std::string& ssid, | |
| 33 const WifiCredentials& credentials, | |
| 34 const SuccessCallback& callback) OVERRIDE; | |
| 35 virtual void ConnectToNetworkByID(const std::string& internal_id, | |
| 36 const SuccessCallback& callback) OVERRIDE; | |
| 37 virtual void RequestNetworkCredentials( | |
| 38 const std::string& internal_id, | |
| 39 const CredentialsCallback& callback) OVERRIDE; | |
| 40 | |
| 41 // Add a network list observer. This observer will be notified every time the | |
| 42 // network list changes. | |
|
stevenjb
2014/05/27 16:49:08
Add/RemoveNetworkListObserver are now part of the
Noam Samuel
2014/05/27 22:24:08
Done.
| |
| 43 virtual void AddNetworkListObserver(NetworkListObserver* observer) OVERRIDE; | |
| 44 | |
| 45 // Remove a network list observer. | |
| 46 virtual void RemoveNetworkListObserver( | |
| 47 NetworkListObserver* observer) OVERRIDE; | |
| 48 | |
| 49 private: | |
| 50 class WifiServiceWrapper; | |
| 51 | |
| 52 // Called when the network list changes. Used for NetworkListWatcher. | |
|
stevenjb
2014/05/27 16:49:08
'Used by WifiServiceWrapper.'
Noam Samuel
2014/05/27 22:24:08
Done.
| |
| 53 void OnNetworkListChanged( | |
| 54 scoped_ptr<std::vector<NetworkProperties> > ssid_list); | |
|
stevenjb
2014/05/27 16:49:08
nit: std::vector<NetworkProperties> is used enough
Noam Samuel
2014/05/27 22:24:08
Done.
| |
| 55 | |
| 56 // Used to post callbacks that take a const& network list without copying the | |
| 57 // vector between threads. | |
| 58 void PostSSIDListCallback( | |
| 59 const SSIDListCallback& callback, | |
| 60 scoped_ptr<std::vector<NetworkProperties> > ssid_list); | |
| 61 | |
| 62 // Used to ensure closures posted from the wifi threads aren't called after | |
| 63 // the service client is deleted. | |
| 64 void PostClosure(const base::Closure& callback); | |
| 65 | |
| 66 std::string original_guid_; | |
| 67 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
| 68 // Owned. Deleted on file thread. | |
|
stevenjb
2014/05/27 16:49:08
nit: Put this comment after the variable, or a bla
Noam Samuel
2014/05/27 22:24:08
Done.
| |
| 69 WifiServiceWrapper* wifi_wrapper_; | |
| 70 ObserverList<NetworkListObserver> network_list_observers_; | |
| 71 | |
| 72 base::WeakPtrFactory<WifiManagerNonChromeos> weak_factory_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(WifiManagerNonChromeos); | |
| 75 }; | |
| 76 | |
| 77 } // namespace wifi | |
| 78 | |
| 79 } // namespace local_discovery | |
| 80 | |
| 81 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_NONCHROMEOS_H_ | |
| OLD | NEW |