Index: chrome/utility/chrome_content_utility_client.cc |
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc |
index 41627d592b2ec5f165033ee87cbe95e6762acdae..7d34fb3185490495e76e5fcd2468e92de3d13c93 100644 |
--- a/chrome/utility/chrome_content_utility_client.cc |
+++ b/chrome/utility/chrome_content_utility_client.cc |
@@ -47,7 +47,9 @@ |
#if defined(OS_WIN) |
#include "base/win/iat_patch_function.h" |
#include "base/win/scoped_handle.h" |
+#include "chrome/common/extensions/api/networking_private/networking_private_crypto.h" |
#include "chrome/utility/media_galleries/itunes_pref_parser_win.h" |
+#include "components/wifi/wifi_service.h" |
#include "printing/emf_win.h" |
#include "ui/gfx/gdi_util.h" |
#endif // defined(OS_WIN) |
@@ -402,6 +404,11 @@ bool ChromeContentUtilityClient::OnMessageReceived( |
OnIndexPicasaAlbumsContents) |
#endif // defined(OS_WIN) || defined(OS_MACOSX) |
+#if defined(OS_WIN) |
+ IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials, |
+ OnGetAndEncryptWiFiCredentials) |
+#endif // defined(OS_WIN) |
+ |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
@@ -903,4 +910,27 @@ void ChromeContentUtilityClient::OnIndexPicasaAlbumsContents( |
} |
#endif // defined(OS_WIN) || defined(OS_MACOSX) |
+#if defined(OS_WIN) |
+void ChromeContentUtilityClient::OnGetAndEncryptWiFiCredentials( |
+ const std::string& network_guid, |
+ const std::vector<uint8>& public_key) { |
+ scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); |
+ wifi_service->Initialize(NULL); |
+ |
+ std::string key_data; |
+ std::string error; |
+ wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); |
+ |
+ std::vector<uint8> ciphertext; |
+ bool success = error.empty() && !key_data.empty(); |
+ if (success) { |
+ NetworkingPrivateCrypto crypto; |
Jorge Lucangeli Obes
2014/03/13 20:07:53
Who reviewed NetworkingPrivateCrypto?
mef
2014/03/13 20:22:29
rsleevi@ here: https://codereview.chromium.org/237
|
+ success = crypto.EncryptByteString(public_key, key_data, &ciphertext); |
+ } |
+ |
+ Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, |
+ success)); |
+} |
+#endif // defined(OS_WIN) |
+ |
} // namespace chrome |