Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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_UTILITY_NETWORKING_PRIVATE_HANDLER_H_ | |
| 6 #define CHROME_UTILITY_NETWORKING_PRIVATE_HANDLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "chrome/utility/utility_message_handler.h" | |
| 15 #include "chrome/utility/wifi/wifi_service.h" | |
| 16 | |
| 17 namespace base { | |
| 18 class DictionaryValue; | |
| 19 class Thread; | |
| 20 } | |
| 21 | |
| 22 namespace chrome { | |
| 23 | |
| 24 // Dispatches IPCs for out of process networkingPrivate API calls. | |
| 25 class NetworkingPrivateHandler : public UtilityMessageHandler { | |
| 26 public: | |
| 27 NetworkingPrivateHandler(); | |
| 28 virtual ~NetworkingPrivateHandler(); | |
| 29 | |
| 30 // IPC::Listener: | |
| 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
|
stevenjb
2013/09/25 19:09:15
WS
mef
2013/10/08 21:46:26
Done.
| |
| 32 // Send IPC message from UtilityThread. | |
| 33 static bool Send(IPC::Message* message); | |
| 34 | |
| 35 private: | |
| 36 // IPC Message Handlers. | |
| 37 | |
| 38 // Use WiFiServiceMock with |parameters| for unit testing. | |
| 39 void OnUseWiFiServiceMock(const base::DictionaryValue& parameters); | |
|
stevenjb
2013/09/25 19:09:15
Append ForTest to the end of this if only used for
mef
2013/10/08 21:46:26
Done.
| |
| 40 | |
| 41 // Common callback from WiFiService when error with |error_name| occurs. | |
| 42 // Sends |NetworkingPrivateMsg_API_Error| back to browser process. | |
| 43 // |message_id| is used to by NetworkingPrivateProcessClient to find matching | |
| 44 // request. | |
| 45 void OnApiError(int message_id, | |
| 46 const std::string& error_name, | |
| 47 scoped_ptr<base::DictionaryValue> error_data); | |
| 48 | |
| 49 // Get properties of network identified by |network_guid|. | |
| 50 void OnGetPropertiesStart(int message_id, const std::string& network_guid); | |
|
stevenjb
2013/09/25 19:09:15
WS
mef
2013/10/08 21:46:26
Done.
| |
| 51 // Callback from |WiFiService| to send |properties| back to browser process. | |
| 52 void OnGetPropertiesSucceeded( | |
| 53 int message_id, | |
| 54 const std::string& network_guid, | |
| 55 const WiFiService::NetworkProperties& properties); | |
| 56 | |
| 57 // Set properties of network identified by |network_guid|. | |
| 58 void OnSetPropertiesStart(int message_id, | |
| 59 const std::string& network_guid, | |
| 60 const base::DictionaryValue& properties); | |
| 61 | |
| 62 // Callback from |WiFiService| to report set properties success back to | |
| 63 // browser process. | |
| 64 void OnSetPropertiesSucceeded(int message_id, | |
| 65 const std::string& network_guid); | |
| 66 | |
| 67 // Start connect to network identified by |network_guid|. Does not wait for | |
| 68 // connect to succeed. If another network is connected, it will be remembered | |
| 69 // and disconnected prior to connect. | |
| 70 void OnStartConnectStart(int message_id, const std::string& network_guid); | |
|
stevenjb
2013/09/25 19:09:15
WS
mef
2013/10/08 21:46:26
Done.
| |
| 71 // Callback from |WiFiService| to report start connect success back to | |
| 72 // browser process. Does not wait for connect to actually succeed. If/When | |
| 73 // connect succeeds the |NetworksChanged| event will be generated. | |
| 74 void OnStartConnectSucceeded(int message_id, const std::string& network_guid); | |
| 75 | |
| 76 // Start disconnect from network identified by |network_guid|. Does not wait | |
| 77 // for disconnect to succeed. | |
| 78 void OnStartDisconnectStart(int message_id, const std::string& network_guid); | |
|
stevenjb
2013/09/25 19:09:15
WS
mef
2013/10/08 21:46:26
Done.
| |
| 79 // Callback from |WiFiService| to report start disconnect success back to | |
| 80 // browser process. Does not wait for disconnect to actually succeed. If/When | |
| 81 // disconnect succeeds the |NetworksChanged| event will be generated. | |
| 82 void OnStartDisconnectSucceeded(int message_id, | |
| 83 const std::string& network_guid); | |
| 84 | |
| 85 // Request network scan. Does not wait for scan to complete. | |
| 86 void OnRequestNetworkScan(); | |
|
stevenjb
2013/09/25 19:09:15
WS
mef
2013/10/08 21:46:26
Done.
| |
| 87 // Callback from |WiFiService| to report that network scan has succeded. | |
| 88 // Generates |NetworkListChanged| event based on current |network_list|. | |
| 89 void OnNetworkScanSucceeded(const WiFiService::NetworkList& network_list); | |
| 90 | |
| 91 // Get current list of visible networks. | |
| 92 void OnGetVisibleNetworks(int message_id); | |
|
stevenjb
2013/09/25 19:09:15
WS
mef
2013/10/08 21:46:26
Done.
| |
| 93 // Callback from |WiFiService| to report list of visible networks. | |
| 94 void OnGetVisibleNetworksSucceeded( | |
| 95 int message_id, | |
| 96 const WiFiService::NetworkList& network_list); | |
| 97 | |
| 98 // Send |NetworkListChanged| event with |network_guid_list|. | |
| 99 void OnNetworkListChangedEvent( | |
| 100 const WiFiService::NetworkGuidList& network_guid_list); | |
| 101 | |
| 102 // Send |NetworksChanged| event with |network_guid_list|. | |
| 103 void OnNetworksChangedEvent( | |
| 104 const WiFiService::NetworkGuidList& network_guid_list); | |
| 105 | |
| 106 // Platform-specific WiFi service. | |
| 107 scoped_ptr<WiFiService> wifi_service_; | |
|
stevenjb
2013/09/25 19:09:15
DISALLOW_COPY_AND_ASSIGN
mef
2013/10/08 21:46:26
Done.
| |
| 108 }; | |
| 109 | |
| 110 } // namespace chrome | |
| 111 | |
| 112 #endif // CHROME_UTILITY_NETWORKING_PRIVATE_HANDLER_H_ | |
| OLD | NEW |