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 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 | 395 |
| 394 #if defined(OS_WIN) || defined(OS_MACOSX) | 396 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 395 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, | 397 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseITunesLibraryXmlFile, |
| 396 OnParseITunesLibraryXmlFile) | 398 OnParseITunesLibraryXmlFile) |
| 397 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, | 399 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParsePicasaPMPDatabase, |
| 398 OnParsePicasaPMPDatabase) | 400 OnParsePicasaPMPDatabase) |
| 399 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, | 401 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_IndexPicasaAlbumsContents, |
| 400 OnIndexPicasaAlbumsContents) | 402 OnIndexPicasaAlbumsContents) |
| 401 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 403 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 402 | 404 |
| 405 #if defined(OS_WIN) | |
| 406 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials, | |
| 407 OnGetAndEncryptWiFiCredentials) | |
| 408 #endif // defined(OS_WIN) | |
| 409 | |
| 403 IPC_MESSAGE_UNHANDLED(handled = false) | 410 IPC_MESSAGE_UNHANDLED(handled = false) |
| 404 IPC_END_MESSAGE_MAP() | 411 IPC_END_MESSAGE_MAP() |
| 405 | 412 |
| 406 for (Handlers::iterator it = handlers_.begin(); | 413 for (Handlers::iterator it = handlers_.begin(); |
| 407 !handled && it != handlers_.end(); ++it) { | 414 !handled && it != handlers_.end(); ++it) { |
| 408 handled = (*it)->OnMessageReceived(message); | 415 handled = (*it)->OnMessageReceived(message); |
| 409 } | 416 } |
| 410 | 417 |
| 411 return handled; | 418 return handled; |
| 412 } | 419 } |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 895 const std::vector<picasa::FolderINIContents>& folders_inis) { | 902 const std::vector<picasa::FolderINIContents>& folders_inis) { |
| 896 picasa::PicasaAlbumsIndexer indexer(album_uids); | 903 picasa::PicasaAlbumsIndexer indexer(album_uids); |
| 897 indexer.ParseFolderINI(folders_inis); | 904 indexer.ParseFolderINI(folders_inis); |
| 898 | 905 |
| 899 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( | 906 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( |
| 900 indexer.albums_images())); | 907 indexer.albums_images())); |
| 901 ReleaseProcessIfNeeded(); | 908 ReleaseProcessIfNeeded(); |
| 902 } | 909 } |
| 903 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 910 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 904 | 911 |
| 912 #if defined(OS_WIN) | |
| 913 void ChromeContentUtilityClient::OnGetAndEncryptWiFiCredentials( | |
| 914 const std::string& network_guid, | |
|
palmer
2014/03/05 00:20:54
Can we use the GUID type in base/guid.h instead?
mef
2014/03/05 01:21:40
It is (admittedly confusingly) called |network_gui
| |
| 915 const std::vector<uint8>& public_key) { | |
| 916 scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create()); | |
| 917 wifi_service->Initialize(NULL); | |
| 918 | |
| 919 std::string key_data; | |
| 920 std::string error; | |
| 921 wifi_service->GetKeyFromSystem(network_guid, &key_data, &error); | |
|
palmer
2014/03/05 00:20:54
Ah, I see. This function expects strings. Is it po
mef
2014/03/05 01:21:40
Strictly speaking WiFiService is a component that
| |
| 922 | |
| 923 std::vector<uint8> ciphertext; | |
| 924 bool success = error.empty() && !key_data.empty(); | |
| 925 if (success) { | |
| 926 NetworkingPrivateCrypto crypto; | |
| 927 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); | |
| 928 } | |
| 929 | |
| 930 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, | |
| 931 success)); | |
| 932 } | |
| 933 #endif // defined(OS_WIN) | |
| 934 | |
| 905 } // namespace chrome | 935 } // namespace chrome |
| OLD | NEW |