Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 26 matching lines...) Expand all Loading... | |
| 37 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
| 38 #include "third_party/zlib/google/zip.h" | 38 #include "third_party/zlib/google/zip.h" |
| 39 #include "ui/base/ui_base_switches.h" | 39 #include "ui/base/ui_base_switches.h" |
| 40 #include "ui/gfx/codec/jpeg_codec.h" | 40 #include "ui/gfx/codec/jpeg_codec.h" |
| 41 #include "ui/gfx/rect.h" | 41 #include "ui/gfx/rect.h" |
| 42 #include "ui/gfx/size.h" | 42 #include "ui/gfx/size.h" |
| 43 | 43 |
| 44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 45 #include "base/win/iat_patch_function.h" | 45 #include "base/win/iat_patch_function.h" |
| 46 #include "base/win/scoped_handle.h" | 46 #include "base/win/scoped_handle.h" |
| 47 #include "chrome/browser/extensions/api/networking_private/networking_private_cr ypto.h" | |
| 47 #include "chrome/utility/media_galleries/itunes_pref_parser_win.h" | 48 #include "chrome/utility/media_galleries/itunes_pref_parser_win.h" |
| 49 #include "components/wifi/wifi_service.h" | |
| 48 #include "printing/emf_win.h" | 50 #include "printing/emf_win.h" |
| 49 #include "ui/gfx/gdi_util.h" | 51 #include "ui/gfx/gdi_util.h" |
| 50 #endif // defined(OS_WIN) | 52 #endif // defined(OS_WIN) |
| 51 | 53 |
| 52 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 53 #include "chrome/utility/media_galleries/iphoto_library_parser.h" | 55 #include "chrome/utility/media_galleries/iphoto_library_parser.h" |
| 54 #endif // defined(OS_MACOSX) | 56 #endif // defined(OS_MACOSX) |
| 55 | 57 |
| 56 #if defined(OS_WIN) || defined(OS_MACOSX) | 58 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 57 #include "chrome/utility/media_galleries/iapps_xml_utils.h" | 59 #include "chrome/utility/media_galleries/iapps_xml_utils.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 | 376 |
| 375 #if defined(OS_WIN) || defined(OS_MACOSX) | 377 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 376 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, | 378 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, |
| 377 OnParseITunesLibraryXmlFile) | 379 OnParseITunesLibraryXmlFile) |
| 378 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, | 380 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, |
| 379 OnParsePicasaPMPDatabase) | 381 OnParsePicasaPMPDatabase) |
| 380 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, | 382 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, |
| 381 OnIndexPicasaAlbumsContents) | 383 OnIndexPicasaAlbumsContents) |
| 382 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 384 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 383 | 385 |
| 386 #if defined(OS_WIN) | |
| 387 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiPassphrase, | |
| 388 OnGetAndEncryptWiFiPassphrase) | |
| 389 #endif // defined(OS_WIN) | |
| 390 | |
| 384 IPC_MESSAGE_UNHANDLED(handled = false) | 391 IPC_MESSAGE_UNHANDLED(handled = false) |
| 385 IPC_END_MESSAGE_MAP() | 392 IPC_END_MESSAGE_MAP() |
| 386 | 393 |
| 387 for (Handlers::iterator it = handlers_.begin(); | 394 for (Handlers::iterator it = handlers_.begin(); |
| 388 !handled && it != handlers_.end(); ++it) { | 395 !handled && it != handlers_.end(); ++it) { |
| 389 handled = (*it)->OnMessageReceived(message); | 396 handled = (*it)->OnMessageReceived(message); |
| 390 } | 397 } |
| 391 | 398 |
| 392 return handled; | 399 return handled; |
| 393 } | 400 } |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 853 const std::vector<picasa::FolderINIContents>& folders_inis) { | 860 const std::vector<picasa::FolderINIContents>& folders_inis) { |
| 854 picasa::PicasaAlbumsIndexer indexer(album_uids); | 861 picasa::PicasaAlbumsIndexer indexer(album_uids); |
| 855 indexer.ParseFolderINI(folders_inis); | 862 indexer.ParseFolderINI(folders_inis); |
| 856 | 863 |
| 857 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( | 864 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( |
| 858 indexer.albums_images())); | 865 indexer.albums_images())); |
| 859 ReleaseProcessIfNeeded(); | 866 ReleaseProcessIfNeeded(); |
| 860 } | 867 } |
| 861 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 868 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 862 | 869 |
| 870 #if defined(OS_WIN) | |
| 871 void ChromeContentUtilityClient::OnGetAndEncryptWiFiPassphrase( | |
| 872 int32 callback_id, | |
| 873 const std::string& network_guid, | |
| 874 const std::string& public_key) { | |
| 875 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); | |
| 876 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
| |
| 877 | |
| 878 std::string passphrase; | |
| 879 std::string error; | |
| 880 wifi_service->GetPassphraseFromSystem(network_guid, &passphrase, &error); | |
| 881 | |
| 882 std::string base64_encoded_ciphertext; | |
| 883 if (error.empty() && !passphrase.empty()) { | |
| 884 NetworkingPrivateCrypto crypto; | |
| 885 std::string ciphertext; | |
| 886 bool encrypted = crypto.EncryptByteString(public_key, | |
| 887 passphrase, | |
| 888 &ciphertext); | |
| 889 if (encrypted) { | |
| 890 base::Base64Encode(ciphertext, &base64_encoded_ciphertext); | |
| 891 } else { | |
| 892 error = "Error.EncryptByteString"; | |
| 893 } | |
| 894 } | |
| 895 | |
| 896 bool test = true; | |
| 897 if (test) { | |
| 898 error = ""; | |
| 899 base64_encoded_ciphertext = "encrypted_credentials"; | |
| 900 } | |
| 901 | |
| 902 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiPassphrase( | |
| 903 callback_id, base64_encoded_ciphertext, error)); | |
| 904 } | |
| 905 #endif // defined(OS_WIN) | |
| 906 | |
| 863 } // namespace chrome | 907 } // namespace chrome |
| OLD | NEW |