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 29 matching lines...) Expand all Loading... | |
40 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
41 #include "third_party/zlib/google/zip.h" | 41 #include "third_party/zlib/google/zip.h" |
42 #include "ui/base/ui_base_switches.h" | 42 #include "ui/base/ui_base_switches.h" |
43 #include "ui/gfx/codec/jpeg_codec.h" | 43 #include "ui/gfx/codec/jpeg_codec.h" |
44 #include "ui/gfx/rect.h" | 44 #include "ui/gfx/rect.h" |
45 #include "ui/gfx/size.h" | 45 #include "ui/gfx/size.h" |
46 | 46 |
47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
48 #include "base/win/iat_patch_function.h" | 48 #include "base/win/iat_patch_function.h" |
49 #include "base/win/scoped_handle.h" | 49 #include "base/win/scoped_handle.h" |
50 #include "chrome/common/extensions/api/networking_private/networking_private_cry pto.h" | |
50 #include "chrome/utility/media_galleries/itunes_pref_parser_win.h" | 51 #include "chrome/utility/media_galleries/itunes_pref_parser_win.h" |
52 #include "components/wifi/wifi_service.h" | |
51 #include "printing/emf_win.h" | 53 #include "printing/emf_win.h" |
52 #include "ui/gfx/gdi_util.h" | 54 #include "ui/gfx/gdi_util.h" |
53 #endif // defined(OS_WIN) | 55 #endif // defined(OS_WIN) |
54 | 56 |
55 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
56 #include "chrome/utility/media_galleries/iphoto_library_parser.h" | 58 #include "chrome/utility/media_galleries/iphoto_library_parser.h" |
57 #endif // defined(OS_MACOSX) | 59 #endif // defined(OS_MACOSX) |
58 | 60 |
59 #if defined(OS_WIN) || defined(OS_MACOSX) | 61 #if defined(OS_WIN) || defined(OS_MACOSX) |
60 #include "chrome/utility/media_galleries/iapps_xml_utils.h" | 62 #include "chrome/utility/media_galleries/iapps_xml_utils.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 | 397 |
396 #if defined(OS_WIN) || defined(OS_MACOSX) | 398 #if defined(OS_WIN) || defined(OS_MACOSX) |
397 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, | 399 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, |
398 OnParseITunesLibraryXmlFile) | 400 OnParseITunesLibraryXmlFile) |
399 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, | 401 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, |
400 OnParsePicasaPMPDatabase) | 402 OnParsePicasaPMPDatabase) |
401 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, | 403 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, |
402 OnIndexPicasaAlbumsContents) | 404 OnIndexPicasaAlbumsContents) |
403 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 405 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
404 | 406 |
407 #if defined(OS_WIN) | |
408 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials, | |
409 OnGetAndEncryptWiFiCredentials) | |
410 #endif // defined(OS_WIN) | |
411 | |
405 IPC_MESSAGE_UNHANDLED(handled = false) | 412 IPC_MESSAGE_UNHANDLED(handled = false) |
406 IPC_END_MESSAGE_MAP() | 413 IPC_END_MESSAGE_MAP() |
407 | 414 |
408 for (Handlers::iterator it = handlers_.begin(); | 415 for (Handlers::iterator it = handlers_.begin(); |
409 !handled && it != handlers_.end(); ++it) { | 416 !handled && it != handlers_.end(); ++it) { |
410 handled = (*it)->OnMessageReceived(message); | 417 handled = (*it)->OnMessageReceived(message); |
411 } | 418 } |
412 | 419 |
413 return handled; | 420 return handled; |
414 } | 421 } |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
896 const std::vector<picasa::FolderINIContents>& folders_inis) { | 903 const std::vector<picasa::FolderINIContents>& folders_inis) { |
897 picasa::PicasaAlbumsIndexer indexer(album_uids); | 904 picasa::PicasaAlbumsIndexer indexer(album_uids); |
898 indexer.ParseFolderINI(folders_inis); | 905 indexer.ParseFolderINI(folders_inis); |
899 | 906 |
900 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( | 907 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( |
901 indexer.albums_images())); | 908 indexer.albums_images())); |
902 ReleaseProcessIfNeeded(); | 909 ReleaseProcessIfNeeded(); |
903 } | 910 } |
904 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 911 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
905 | 912 |
913 #if defined(OS_WIN) | |
914 void ChromeContentUtilityClient::OnGetAndEncryptWiFiCredentials( | |
915 const std::string& network_guid, | |
916 const std::vector<uint8>& public_key) { | |
917 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); | |
918 wifi_service->Initialize(NULL); | |
919 | |
920 std::string key_data; | |
921 std::string error; | |
922 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); | |
923 | |
924 std::vector<uint8> ciphertext; | |
925 bool success = error.empty() && !key_data.empty(); | |
926 if (success) { | |
927 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
| |
928 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); | |
929 } | |
930 | |
931 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, | |
932 success)); | |
933 } | |
934 #endif // defined(OS_WIN) | |
935 | |
906 } // namespace chrome | 936 } // namespace chrome |
OLD | NEW |