| 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_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_SESSION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_SESSION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_SESSION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_SESSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 typedef extensions::api::gcd_private::Status Result; | 42 typedef extensions::api::gcd_private::Status Result; |
| 43 | 43 |
| 44 typedef base::Callback< | 44 typedef base::Callback< |
| 45 void(Result result, const base::DictionaryValue& response)> InitCallback; | 45 void(Result result, const base::DictionaryValue& response)> InitCallback; |
| 46 | 46 |
| 47 typedef base::Callback<void(Result result)> ResultCallback; | 47 typedef base::Callback<void(Result result)> ResultCallback; |
| 48 typedef base::Callback<void(Result result, | 48 typedef base::Callback<void(Result result, |
| 49 const base::DictionaryValue& response)> | 49 const base::DictionaryValue& response)> |
| 50 MessageCallback; | 50 MessageCallback; |
| 51 | 51 |
| 52 explicit PrivetV3Session( | 52 PrivetV3Session( |
| 53 scoped_ptr<local_discovery::PrivetHTTPClient> client); | 53 const scoped_refptr<net::URLRequestContextGetter>& context_getter, |
| 54 const net::HostPortPair& host_port); |
| 54 ~PrivetV3Session(); | 55 ~PrivetV3Session(); |
| 55 | 56 |
| 56 // Initializes session. Queries /privet/info and returns supported pairing | 57 // Initializes session. Queries /privet/info and returns supported pairing |
| 57 // types in callback. | 58 // types in callback. |
| 58 void Init(const InitCallback& callback); | 59 void Init(const InitCallback& callback); |
| 59 | 60 |
| 60 // Starts pairing by calling /privet/v3/pairing/start. | 61 // Starts pairing by calling /privet/v3/pairing/start. |
| 61 void StartPairing(PairingType pairing_type, const ResultCallback& callback); | 62 void StartPairing(PairingType pairing_type, const ResultCallback& callback); |
| 62 | 63 |
| 63 // Confirms pairing code by calling /privet/v3/pairing/confirm. | 64 // Confirms pairing code by calling /privet/v3/pairing/confirm. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Intercepts POST requests. Used by tests only. | 123 // Intercepts POST requests. Used by tests only. |
| 123 base::Callback<void(const base::DictionaryValue&)> on_post_data_; | 124 base::Callback<void(const base::DictionaryValue&)> on_post_data_; |
| 124 | 125 |
| 125 base::WeakPtrFactory<PrivetV3Session> weak_ptr_factory_; | 126 base::WeakPtrFactory<PrivetV3Session> weak_ptr_factory_; |
| 126 DISALLOW_COPY_AND_ASSIGN(PrivetV3Session); | 127 DISALLOW_COPY_AND_ASSIGN(PrivetV3Session); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 } // namespace extensions | 130 } // namespace extensions |
| 130 | 131 |
| 131 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_SESSION_H_ | 132 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_PRIVET_V3_SESSION_H_ |
| OLD | NEW |