OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 REMOTING_HOST_GCD_REST_CLIENT_H_ | 5 #ifndef REMOTING_HOST_GCD_REST_CLIENT_H_ |
6 #define REMOTING_HOST_GCD_REST_CLIENT_H_ | 6 #define REMOTING_HOST_GCD_REST_CLIENT_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 GcdRestClient(const std::string& gcd_base_url, | 38 GcdRestClient(const std::string& gcd_base_url, |
39 const std::string& gcd_device_id, | 39 const std::string& gcd_device_id, |
40 const scoped_refptr<net::URLRequestContextGetter>& | 40 const scoped_refptr<net::URLRequestContextGetter>& |
41 url_request_context_getter, | 41 url_request_context_getter, |
42 OAuthTokenGetter* token_getter); | 42 OAuthTokenGetter* token_getter); |
43 | 43 |
44 ~GcdRestClient() override; | 44 ~GcdRestClient() override; |
45 | 45 |
46 // Tests whether is object is currently running a request. Only one | 46 // Tests whether is object is currently running a request. Only one |
47 // request at a time may be pending. | 47 // request at a time may be pending. |
48 bool HasPendingRequest() { return url_fetcher_; } | 48 bool HasPendingRequest() { return !!url_fetcher_; } |
49 | 49 |
50 // Sends a 'patchState' request to the GCD API. Constructs and | 50 // Sends a 'patchState' request to the GCD API. Constructs and |
51 // sends an appropriate JSON message M where |patch_details| becomes | 51 // sends an appropriate JSON message M where |patch_details| becomes |
52 // the value of M.patches[0].patch. | 52 // the value of M.patches[0].patch. |
53 void PatchState(scoped_ptr<base::DictionaryValue> patch_details, | 53 void PatchState(scoped_ptr<base::DictionaryValue> patch_details, |
54 const GcdRestClient::ResultCallback& callback); | 54 const GcdRestClient::ResultCallback& callback); |
55 | 55 |
56 void SetClockForTest(scoped_ptr<base::Clock> clock); | 56 void SetClockForTest(scoped_ptr<base::Clock> clock); |
57 | 57 |
58 private: | 58 private: |
(...skipping 12 matching lines...) Expand all Loading... |
71 scoped_ptr<base::Clock> clock_; | 71 scoped_ptr<base::Clock> clock_; |
72 scoped_ptr<net::URLFetcher> url_fetcher_; | 72 scoped_ptr<net::URLFetcher> url_fetcher_; |
73 ResultCallback callback_; | 73 ResultCallback callback_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(GcdRestClient); | 75 DISALLOW_COPY_AND_ASSIGN(GcdRestClient); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace remoting | 78 } // namespace remoting |
79 | 79 |
80 #endif // REMOTING_HOST_GCD_REST_CLIENT_H_ | 80 #endif // REMOTING_HOST_GCD_REST_CLIENT_H_ |
OLD | NEW |