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