OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_WIFI_PASSPHRASE_GETTER_
H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_WIFI_PASSPHRASE_GETTER_
H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/utility_process_host_client.h" |
| 14 |
| 15 namespace extensions { |
| 16 |
| 17 // WiFiPassphraseGetter gets plain-text WiFi passphrase from the system |
| 18 // (requires UAC privilege elevation) and encrypts it with public key. |
| 19 class WiFiPassphraseGetter : public content::UtilityProcessHostClient { |
| 20 public: |
| 21 typedef base::Callback<void(const std::string& passphrase, |
| 22 const std::string& error)> PassphraseCallback; |
| 23 |
| 24 WiFiPassphraseGetter(const PassphraseCallback& callback, |
| 25 int32 callback_id, |
| 26 const std::string& network_guid, |
| 27 const std::string& public_key); |
| 28 |
| 29 void Start(); |
| 30 |
| 31 private: |
| 32 friend class ProcessHostClient; |
| 33 |
| 34 virtual ~WiFiPassphraseGetter(); |
| 35 |
| 36 // Starts the utility process that gets wifi passphrase from |
| 37 void StartProcessOnIOThread(int32 callback_id, |
| 38 const std::string& network_guid, |
| 39 const std::string& public_key); |
| 40 |
| 41 // UtilityProcessHostClient |
| 42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 43 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 44 |
| 45 // IPC message handlers. |
| 46 void OnGotEncryptedWiFiPassphrase(int32 callback_id, |
| 47 const std::string& passphrase, |
| 48 const std::string& error); |
| 49 |
| 50 void ReportEncryptedPassphraseOnUIThread(const std::string& passphrase, |
| 51 const std::string& error); |
| 52 |
| 53 // The callback. |
| 54 PassphraseCallback callback_; |
| 55 |
| 56 int32 callback_id_; |
| 57 std::string network_guid_; |
| 58 std::string public_key_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(WiFiPassphraseGetter); |
| 61 }; |
| 62 |
| 63 } // namespace extensions |
| 64 |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_WIFI_PASSPHRASE_GETT
ER_H_ |
OLD | NEW |