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_NETWORKING_PRIVATE_CREDENTIALS_GETTER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CREDENTIALS_GETTER_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "base/basictypes.h" 12 #include "chrome/browser/extensions/api/networking_private/networking_private_service_client.h" 13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/utility_process_host_client.h" 15 16 namespace extensions { 17 18 // NetworkingPrivateCredentialsGetter gets plain-text WiFi credentials from the 19 // system and encrypts it with public key. 20 class NetworkingPrivateCredentialsGetter { 21 public: 22 static NetworkingPrivateCredentialsGetter* Create(); 23 NetworkingPrivateCredentialsGetter()24 NetworkingPrivateCredentialsGetter() {} 25 ~NetworkingPrivateCredentialsGetter()26 virtual ~NetworkingPrivateCredentialsGetter() {} 27 28 // Starts getting credentials. The credentials and, in case of an error, the 29 // error code are returned using |callback|. 30 // The NetworkingPrivateCredentialsGetter implementation should ensure that 31 // the credentials request can be successfully processed even if |this| gets 32 // deleted immediately after calling this method. 33 // Note that there are no guarantees about the thread on which |callback| is 34 // run. The caller should make sure that the result is processed on the right 35 // thread. 36 virtual void Start( 37 const std::string& network_guid, 38 const std::string& public_key, 39 const extensions::NetworkingPrivateServiceClient::CryptoVerify:: 40 VerifyAndEncryptCredentialsCallback& callback) = 0; 41 42 private: 43 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCredentialsGetter); 44 }; 45 46 } // namespace extensions 47 48 #endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CREDENTIALS_GETTER_H_ 49