| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" | 5 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "chrome/common/extensions/api/networking_private/networking_private_cry
pto.h" | 11 #include "chrome/common/extensions/api/networking_private/networking_private_cry
pto.h" |
| 12 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 12 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/utility_process_host.h" | 14 #include "content/public/browser/utility_process_host.h" |
| 15 | 15 |
| 16 using content::BrowserThread; | 16 using content::BrowserThread; |
| 17 using content::UtilityProcessHost; | 17 using content::UtilityProcessHost; |
| 18 using extensions::NetworkingPrivateCredentialsGetter; | 18 using extensions::NetworkingPrivateCredentialsGetter; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class CredentialsGetterHostClient : public content::UtilityProcessHostClient { | 22 class CredentialsGetterHostClient : public content::UtilityProcessHostClient { |
| 23 public: | 23 public: |
| 24 explicit CredentialsGetterHostClient(const std::string& public_key); | 24 explicit CredentialsGetterHostClient(const std::string& public_key); |
| 25 | 25 |
| 26 virtual ~CredentialsGetterHostClient(); | 26 virtual ~CredentialsGetterHostClient(); |
| 27 | 27 |
| 28 // UtilityProcessHostClient | 28 // UtilityProcessHostClient |
| 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 29 virtual bool OnMessageReceived(const IPC::Message& message) override; |
| 30 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 30 virtual void OnProcessCrashed(int exit_code) override; |
| 31 virtual void OnProcessLaunchFailed() OVERRIDE; | 31 virtual void OnProcessLaunchFailed() override; |
| 32 | 32 |
| 33 // IPC message handlers. | 33 // IPC message handlers. |
| 34 void OnGotCredentials(const std::string& key_data, bool success); | 34 void OnGotCredentials(const std::string& key_data, bool success); |
| 35 | 35 |
| 36 // Starts the utility process that gets wifi passphrase from system. | 36 // Starts the utility process that gets wifi passphrase from system. |
| 37 void StartProcessOnIOThread( | 37 void StartProcessOnIOThread( |
| 38 const std::string& network_guid, | 38 const std::string& network_guid, |
| 39 const extensions::NetworkingPrivateServiceClient::CryptoVerify:: | 39 const extensions::NetworkingPrivateServiceClient::CryptoVerify:: |
| 40 VerifyAndEncryptCredentialsCallback& callback); | 40 VerifyAndEncryptCredentialsCallback& callback); |
| 41 | 41 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 class NetworkingPrivateCredentialsGetterWin | 113 class NetworkingPrivateCredentialsGetterWin |
| 114 : public NetworkingPrivateCredentialsGetter { | 114 : public NetworkingPrivateCredentialsGetter { |
| 115 public: | 115 public: |
| 116 NetworkingPrivateCredentialsGetterWin(); | 116 NetworkingPrivateCredentialsGetterWin(); |
| 117 | 117 |
| 118 virtual void Start( | 118 virtual void Start( |
| 119 const std::string& network_guid, | 119 const std::string& network_guid, |
| 120 const std::string& public_key, | 120 const std::string& public_key, |
| 121 const extensions::NetworkingPrivateServiceClient::CryptoVerify:: | 121 const extensions::NetworkingPrivateServiceClient::CryptoVerify:: |
| 122 VerifyAndEncryptCredentialsCallback& callback) OVERRIDE; | 122 VerifyAndEncryptCredentialsCallback& callback) override; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 virtual ~NetworkingPrivateCredentialsGetterWin(); | 125 virtual ~NetworkingPrivateCredentialsGetterWin(); |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCredentialsGetterWin); | 127 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCredentialsGetterWin); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 NetworkingPrivateCredentialsGetterWin::NetworkingPrivateCredentialsGetterWin() { | 130 NetworkingPrivateCredentialsGetterWin::NetworkingPrivateCredentialsGetterWin() { |
| 131 } | 131 } |
| 132 | 132 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 146 | 146 |
| 147 NetworkingPrivateCredentialsGetterWin:: | 147 NetworkingPrivateCredentialsGetterWin:: |
| 148 ~NetworkingPrivateCredentialsGetterWin() {} | 148 ~NetworkingPrivateCredentialsGetterWin() {} |
| 149 | 149 |
| 150 NetworkingPrivateCredentialsGetter* | 150 NetworkingPrivateCredentialsGetter* |
| 151 NetworkingPrivateCredentialsGetter::Create() { | 151 NetworkingPrivateCredentialsGetter::Create() { |
| 152 return new NetworkingPrivateCredentialsGetterWin(); | 152 return new NetworkingPrivateCredentialsGetterWin(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |