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

Side by Side Diff: chrome/utility/extensions/extensions_handler.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, 3 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
« no previous file with comments | « chrome/utility/extensions/extensions_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/extensions_handler.h" 5 #include "chrome/utility/extensions/extensions_handler.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/common/chrome_utility_messages.h" 9 #include "chrome/common/chrome_utility_messages.h"
10 #include "chrome/common/extensions/chrome_extensions_client.h" 10 #include "chrome/common/extensions/chrome_extensions_client.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 #if defined(OS_WIN) || defined(OS_MACOSX) 104 #if defined(OS_WIN) || defined(OS_MACOSX)
105 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, 105 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile,
106 OnParseITunesLibraryXmlFile) 106 OnParseITunesLibraryXmlFile)
107 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, 107 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase,
108 OnParsePicasaPMPDatabase) 108 OnParsePicasaPMPDatabase)
109 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, 109 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents,
110 OnIndexPicasaAlbumsContents) 110 OnIndexPicasaAlbumsContents)
111 #endif // defined(OS_WIN) || defined(OS_MACOSX) 111 #endif // defined(OS_WIN) || defined(OS_MACOSX)
112 112
113 #if defined(OS_WIN) 113 #if defined(OS_WIN)
114 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials, 114 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetWiFiCredentials,
115 OnGetAndEncryptWiFiCredentials) 115 OnGetWiFiCredentials)
116 #endif // defined(OS_WIN) 116 #endif // defined(OS_WIN)
117 117
118 IPC_MESSAGE_UNHANDLED(handled = false) 118 IPC_MESSAGE_UNHANDLED(handled = false)
119 IPC_END_MESSAGE_MAP() 119 IPC_END_MESSAGE_MAP()
120 return handled; 120 return handled;
121 } 121 }
122 122
123 void ExtensionsHandler::OnUnpackExtension( 123 void ExtensionsHandler::OnUnpackExtension(
124 const base::FilePath& extension_path, 124 const base::FilePath& extension_path,
125 const std::string& extension_id, 125 const std::string& extension_id,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 picasa::PicasaAlbumsIndexer indexer(album_uids); 275 picasa::PicasaAlbumsIndexer indexer(album_uids);
276 indexer.ParseFolderINI(folders_inis); 276 indexer.ParseFolderINI(folders_inis);
277 277
278 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( 278 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished(
279 indexer.albums_images())); 279 indexer.albums_images()));
280 ReleaseProcessIfNeeded(); 280 ReleaseProcessIfNeeded();
281 } 281 }
282 #endif // defined(OS_WIN) || defined(OS_MACOSX) 282 #endif // defined(OS_WIN) || defined(OS_MACOSX)
283 283
284 #if defined(OS_WIN) 284 #if defined(OS_WIN)
285 void ExtensionsHandler::OnGetAndEncryptWiFiCredentials( 285 void ExtensionsHandler::OnGetWiFiCredentials(const std::string& network_guid) {
286 const std::string& network_guid,
287 const std::vector<uint8>& public_key) {
288 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); 286 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
289 wifi_service->Initialize(NULL); 287 wifi_service->Initialize(NULL);
290 288
291 std::string key_data; 289 std::string key_data;
292 std::string error; 290 std::string error;
293 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); 291 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error);
294 292
295 std::vector<uint8> ciphertext; 293 Send(new ChromeUtilityHostMsg_GotWiFiCredentials(key_data, error.empty()));
296 bool success = error.empty() && !key_data.empty();
297 if (success) {
298 success = networking_private_crypto::EncryptByteString(
299 public_key, key_data, &ciphertext);
300 }
301
302 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext,
303 success));
304 } 294 }
305 #endif // defined(OS_WIN) 295 #endif // defined(OS_WIN)
306 296
307 } // namespace extensions 297 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/utility/extensions/extensions_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698