| Index: chrome/browser/extensions/api/networking_private/wifi_passphrase_getter.h
|
| diff --git a/chrome/browser/extensions/api/networking_private/wifi_passphrase_getter.h b/chrome/browser/extensions/api/networking_private/wifi_passphrase_getter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7280a388fb23ec849f2c42d0b4d697469376032a
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/networking_private/wifi_passphrase_getter.h
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_WIFI_PASSPHRASE_GETTER_H_
|
| +#define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_WIFI_PASSPHRASE_GETTER_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/utility_process_host_client.h"
|
| +
|
| +namespace extensions {
|
| +
|
| +// WiFiPassphraseGetter gets plain-text WiFi passphrase from the system
|
| +// (requires UAC privilege elevation) and encrypts it with public key.
|
| +class WiFiPassphraseGetter : public content::UtilityProcessHostClient {
|
| + public:
|
| + typedef base::Callback<void(const std::string& passphrase,
|
| + const std::string& error)> PassphraseCallback;
|
| +
|
| + WiFiPassphraseGetter(const PassphraseCallback& callback,
|
| + int32 callback_id,
|
| + const std::string& network_guid,
|
| + const std::string& public_key);
|
| +
|
| + void Start();
|
| +
|
| + private:
|
| + friend class ProcessHostClient;
|
| +
|
| + virtual ~WiFiPassphraseGetter();
|
| +
|
| + // Starts the utility process that gets wifi passphrase from
|
| + void StartProcessOnIOThread(int32 callback_id,
|
| + const std::string& network_guid,
|
| + const std::string& public_key);
|
| +
|
| + // UtilityProcessHostClient
|
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
| + virtual void OnProcessCrashed(int exit_code) OVERRIDE;
|
| +
|
| + // IPC message handlers.
|
| + void OnGotEncryptedWiFiPassphrase(int32 callback_id,
|
| + const std::string& passphrase,
|
| + const std::string& error);
|
| +
|
| + void ReportEncryptedPassphraseOnUIThread(const std::string& passphrase,
|
| + const std::string& error);
|
| +
|
| + // The callback.
|
| + PassphraseCallback callback_;
|
| +
|
| + int32 callback_id_;
|
| + std::string network_guid_;
|
| + std::string public_key_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WiFiPassphraseGetter);
|
| +};
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_WIFI_PASSPHRASE_GETTER_H_
|
|
|