| Index: chrome/utility/networking_private_handler.h
|
| diff --git a/chrome/utility/networking_private_handler.h b/chrome/utility/networking_private_handler.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2328b9ef349235c7993ca1d9798a38899e3eef4b
|
| --- /dev/null
|
| +++ b/chrome/utility/networking_private_handler.h
|
| @@ -0,0 +1,121 @@
|
| +// Copyright (c) 2013 The Chromium 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 CHROME_UTILITY_NETWORKING_PRIVATE_HANDLER_H_
|
| +#define CHROME_UTILITY_NETWORKING_PRIVATE_HANDLER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "chrome/utility/utility_message_handler.h"
|
| +#include "chrome/utility/wifi/wifi_service.h"
|
| +
|
| +namespace base {
|
| +class DictionaryValue;
|
| +class Thread;
|
| +}
|
| +
|
| +using wifi::WiFiService;
|
| +
|
| +namespace chrome {
|
| +
|
| +// Dispatches IPCs for out of process networkingPrivate API calls.
|
| +class NetworkingPrivateHandler : public UtilityMessageHandler {
|
| + public:
|
| + NetworkingPrivateHandler();
|
| + virtual ~NetworkingPrivateHandler();
|
| +
|
| + // IPC::Listener:
|
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| + // Send IPC message from UtilityThread.
|
| + static bool Send(IPC::Message* message);
|
| +
|
| + private:
|
| + // IPC Message Handlers.
|
| +
|
| + // Use WiFiServiceMock with |parameters| for unit testing.
|
| + void OnUseWiFiServiceMockForTest(const base::DictionaryValue& parameters);
|
| +
|
| + // Common callback from WiFiService when error with |error_name| occurs.
|
| + // Sends |NetworkingPrivateMsg_API_Error| back to browser process.
|
| + // |message_id| is used to by NetworkingPrivateProcessClient to find matching
|
| + // request.
|
| + void OnApiError(int message_id,
|
| + const std::string& error_name,
|
| + scoped_ptr<base::DictionaryValue> error_data);
|
| +
|
| + // Get properties of network identified by |network_guid|.
|
| + void OnGetPropertiesStart(int message_id, const std::string& network_guid);
|
| +
|
| + // Callback from |WiFiService| to send |properties| back to browser process.
|
| + void OnGetPropertiesSucceeded(
|
| + int message_id,
|
| + const std::string& network_guid,
|
| + const WiFiService::NetworkProperties& properties);
|
| +
|
| + // Set properties of network identified by |network_guid|.
|
| + void OnSetPropertiesStart(int message_id,
|
| + const std::string& network_guid,
|
| + const base::DictionaryValue& properties);
|
| +
|
| + // Callback from |WiFiService| to report set properties success back to
|
| + // browser process.
|
| + void OnSetPropertiesSucceeded(int message_id,
|
| + const std::string& network_guid);
|
| +
|
| + // Start connect to network identified by |network_guid|. Does not wait for
|
| + // connect to succeed. If another network is connected, it will be remembered
|
| + // and disconnected prior to connect.
|
| + void OnStartConnectStart(int message_id, const std::string& network_guid);
|
| +
|
| + // Callback from |WiFiService| to report start connect success back to
|
| + // browser process. Does not wait for connect to actually succeed. If/When
|
| + // connect succeeds the |NetworksChanged| event will be generated.
|
| + void OnStartConnectSucceeded(int message_id, const std::string& network_guid);
|
| +
|
| + // Start disconnect from network identified by |network_guid|. Does not wait
|
| + // for disconnect to succeed.
|
| + void OnStartDisconnectStart(int message_id, const std::string& network_guid);
|
| +
|
| + // Callback from |WiFiService| to report start disconnect success back to
|
| + // browser process. Does not wait for disconnect to actually succeed. If/When
|
| + // disconnect succeeds the |NetworksChanged| event will be generated.
|
| + void OnStartDisconnectSucceeded(int message_id,
|
| + const std::string& network_guid);
|
| +
|
| + // Request network scan. Does not wait for scan to complete.
|
| + void OnRequestNetworkScan();
|
| +
|
| + // Callback from |WiFiService| to report that network scan has succeded.
|
| + // Generates |NetworkListChanged| event based on current |network_list|.
|
| + void OnNetworkScanSucceeded(const WiFiService::NetworkList& network_list);
|
| +
|
| + // Get current list of visible networks.
|
| + void OnGetVisibleNetworks(int message_id);
|
| +
|
| + // Callback from |WiFiService| to report list of visible networks.
|
| + void OnGetVisibleNetworksSucceeded(
|
| + int message_id,
|
| + const WiFiService::NetworkList& network_list);
|
| +
|
| + // Send |NetworkListChanged| event with |network_guid_list|.
|
| + void OnNetworkListChangedEvent(
|
| + const WiFiService::NetworkGuidList& network_guid_list);
|
| +
|
| + // Send |NetworksChanged| event with |network_guid_list|.
|
| + void OnNetworksChangedEvent(
|
| + const WiFiService::NetworkGuidList& network_guid_list);
|
| +
|
| + // Platform-specific WiFi service.
|
| + scoped_ptr<wifi::WiFiService> wifi_service_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateHandler);
|
| +};
|
| +
|
| +} // namespace chrome
|
| +
|
| +#endif // CHROME_UTILITY_NETWORKING_PRIVATE_HANDLER_H_
|
|
|