Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 343053002: Credential passing for WifiManager in Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 #if defined(OS_WIN) || defined(OS_MACOSX) 407 #if defined(OS_WIN) || defined(OS_MACOSX)
408 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, 408 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile,
409 OnParseITunesLibraryXmlFile) 409 OnParseITunesLibraryXmlFile)
410 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, 410 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase,
411 OnParsePicasaPMPDatabase) 411 OnParsePicasaPMPDatabase)
412 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, 412 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents,
413 OnIndexPicasaAlbumsContents) 413 OnIndexPicasaAlbumsContents)
414 #endif // defined(OS_WIN) || defined(OS_MACOSX) 414 #endif // defined(OS_WIN) || defined(OS_MACOSX)
415 415
416 #if defined(OS_WIN) 416 #if defined(OS_WIN)
417 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials, 417 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetWiFiCredentials,
418 OnGetAndEncryptWiFiCredentials) 418 OnGetWiFiCredentials)
419 #endif // defined(OS_WIN) 419 #endif // defined(OS_WIN)
420 420
421 IPC_MESSAGE_UNHANDLED(handled = false) 421 IPC_MESSAGE_UNHANDLED(handled = false)
422 IPC_END_MESSAGE_MAP() 422 IPC_END_MESSAGE_MAP()
423 423
424 for (Handlers::iterator it = handlers_.begin(); 424 for (Handlers::iterator it = handlers_.begin();
425 !handled && it != handlers_.end(); ++it) { 425 !handled && it != handlers_.end(); ++it) {
426 handled = (*it)->OnMessageReceived(message); 426 handled = (*it)->OnMessageReceived(message);
427 } 427 }
428 428
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 picasa::PicasaAlbumsIndexer indexer(album_uids); 1006 picasa::PicasaAlbumsIndexer indexer(album_uids);
1007 indexer.ParseFolderINI(folders_inis); 1007 indexer.ParseFolderINI(folders_inis);
1008 1008
1009 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( 1009 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished(
1010 indexer.albums_images())); 1010 indexer.albums_images()));
1011 ReleaseProcessIfNeeded(); 1011 ReleaseProcessIfNeeded();
1012 } 1012 }
1013 #endif // defined(OS_WIN) || defined(OS_MACOSX) 1013 #endif // defined(OS_WIN) || defined(OS_MACOSX)
1014 1014
1015 #if defined(OS_WIN) 1015 #if defined(OS_WIN)
1016 void ChromeContentUtilityClient::OnGetAndEncryptWiFiCredentials( 1016 void ChromeContentUtilityClient::OnGetWiFiCredentials(
1017 const std::string& network_guid, 1017 const std::string& network_guid) {
1018 const std::vector<uint8>& public_key) {
1019 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); 1018 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
1020 wifi_service->Initialize(NULL); 1019 wifi_service->Initialize(NULL);
1021 1020
1022 std::string key_data; 1021 std::string key_data;
1023 std::string error; 1022 std::string error;
1024 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); 1023 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error);
1025 1024
1026 std::vector<uint8> ciphertext; 1025 Send(new ChromeUtilityHostMsg_GotWiFiCredentials(key_data, error.empty()));
1027 bool success = error.empty() && !key_data.empty();
1028 if (success) {
1029 NetworkingPrivateCrypto crypto;
1030 success = crypto.EncryptByteString(public_key, key_data, &ciphertext);
1031 }
1032
1033 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext,
1034 success));
1035 } 1026 }
1036 #endif // defined(OS_WIN) 1027 #endif // defined(OS_WIN)
1037 1028
1038 } // namespace chrome 1029 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698