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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 const std::vector<picasa::FolderINIContents>& folders_inis) { | 906 const std::vector<picasa::FolderINIContents>& folders_inis) { |
900 picasa::PicasaAlbumsIndexer indexer(album_uids); | 907 picasa::PicasaAlbumsIndexer indexer(album_uids); |
901 indexer.ParseFolderINI(folders_inis); | 908 indexer.ParseFolderINI(folders_inis); |
902 | 909 |
903 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( | 910 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( |
904 indexer.albums_images())); | 911 indexer.albums_images())); |
905 ReleaseProcessIfNeeded(); | 912 ReleaseProcessIfNeeded(); |
906 } | 913 } |
907 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 914 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
908 | 915 |
| 916 #if defined(OS_WIN) |
| 917 void ChromeContentUtilityClient::OnGetAndEncryptWiFiCredentials( |
| 918 const std::string& network_guid, |
| 919 const std::vector<uint8>& public_key) { |
| 920 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); |
| 921 wifi_service->Initialize(NULL); |
| 922 |
| 923 std::string key_data; |
| 924 std::string error; |
| 925 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); |
| 926 |
| 927 std::vector<uint8> ciphertext; |
| 928 bool success = error.empty() && !key_data.empty(); |
| 929 if (success) { |
| 930 NetworkingPrivateCrypto crypto; |
| 931 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); |
| 932 } |
| 933 |
| 934 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, |
| 935 success)); |
| 936 } |
| 937 #endif // defined(OS_WIN) |
| 938 |
909 } // namespace chrome | 939 } // namespace chrome |
OLD | NEW |