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_LOCAL_DISCOVERY_WIFI_CREDENTIAL_GETTER_WIN_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_CREDENTIAL_GETTER_WIN_H_ |
| 7 |
| 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "content/public/browser/utility_process_host.h" |
| 10 #include "content/public/browser/utility_process_host_client.h" |
| 11 |
| 12 namespace local_discovery { |
| 13 namespace wifi { |
| 14 |
| 15 class CredentialGetterWin : public content::UtilityProcessHostClient { |
| 16 public: |
| 17 typedef base::Callback<void(bool success, const std::string& key)> |
| 18 CredentialsCallback; |
| 19 |
| 20 CredentialGetterWin(); |
| 21 virtual ~CredentialGetterWin(); |
| 22 |
| 23 void StartGetCredentials(const std::string& network_guid, |
| 24 const CredentialsCallback& callback); |
| 25 |
| 26 // Used in cases where base::MessageLoopProxy::current() does not exist. |
| 27 void SetCallbackRunner( |
| 28 const scoped_refptr<base::TaskRunner>& callback_runner); |
| 29 |
| 30 private: |
| 31 // UtilityProcessHostClient |
| 32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 33 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 34 virtual void OnProcessLaunchFailed() OVERRIDE; |
| 35 |
| 36 // IPC message handlers. |
| 37 void OnGotCredentials(const std::string& key_data, bool success); |
| 38 |
| 39 void StartOnIOThread(const std::string& network_guid); |
| 40 |
| 41 void PostCallback(bool success, const std::string& key_data); |
| 42 |
| 43 CredentialsCallback callback_; |
| 44 scoped_refptr<base::TaskRunner> callback_runner_; |
| 45 }; |
| 46 |
| 47 } // namespace wifi |
| 48 } // namespace local_discovery |
| 49 |
| 50 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_CREDENTIAL_GETTER_WIN_H_ |
OLD | NEW |