Chromium Code Reviews| 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 9c883f5161fb9b962c82f314a635035691fdaf93..0fdfbbf2e27fd4300cb5f833f1d5181fceaed5a8 100644 |
| --- a/chrome/utility/chrome_content_utility_client.cc |
| +++ b/chrome/utility/chrome_content_utility_client.cc |
| @@ -44,7 +44,9 @@ |
| #if defined(OS_WIN) |
| #include "base/win/iat_patch_function.h" |
| #include "base/win/scoped_handle.h" |
| +#include "chrome/browser/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) |
| @@ -381,6 +383,11 @@ bool ChromeContentUtilityClient::OnMessageReceived( |
| OnIndexPicasaAlbumsContents) |
| #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| +#if defined(OS_WIN) |
| + IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiPassphrase, |
| + OnGetAndEncryptWiFiPassphrase) |
| +#endif // defined(OS_WIN) |
| + |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| @@ -860,4 +867,41 @@ void ChromeContentUtilityClient::OnIndexPicasaAlbumsContents( |
| } |
| #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| +#if defined(OS_WIN) |
| +void ChromeContentUtilityClient::OnGetAndEncryptWiFiPassphrase( |
| + int32 callback_id, |
| + const std::string& network_guid, |
| + const std::string& public_key) { |
| + scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); |
| + wifi_service->Initialize(NULL); |
|
tbarzic
2014/02/07 19:25:00
hm, wifi_service does much more than we need.
Can
mef
2014/02/07 19:53:31
Yes and no. One of important functions of WiFiServ
tbarzic
2014/02/07 22:43:02
OK then. Though it would be nice if we prevented t
tbarzic
2014/02/21 19:02:51
I think you missed this comment :)
mef
2014/02/25 19:57:59
Sorry, you are right. I've moved call to WlanRegis
|
| + |
| + std::string passphrase; |
| + std::string error; |
| + wifi_service->GetPassphraseFromSystem(network_guid, &passphrase, &error); |
| + |
| + std::string base64_encoded_ciphertext; |
| + if (error.empty() && !passphrase.empty()) { |
| + NetworkingPrivateCrypto crypto; |
| + std::string ciphertext; |
| + bool encrypted = crypto.EncryptByteString(public_key, |
| + passphrase, |
| + &ciphertext); |
| + if (encrypted) { |
| + base::Base64Encode(ciphertext, &base64_encoded_ciphertext); |
| + } else { |
| + error = "Error.EncryptByteString"; |
| + } |
| + } |
| + |
| + bool test = true; |
| + if (test) { |
| + error = ""; |
| + base64_encoded_ciphertext = "encrypted_credentials"; |
| + } |
| + |
| + Send(new ChromeUtilityHostMsg_GotEncryptedWiFiPassphrase( |
| + callback_id, base64_encoded_ciphertext, error)); |
| +} |
| +#endif // defined(OS_WIN) |
| + |
| } // namespace chrome |