| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/host/service_client.h" | 5 #include "remoting/host/service_client.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "net/http/http_status_code.h" | 11 #include "net/http/http_status_code.h" |
| 12 #include "net/url_request/url_fetcher.h" | 12 #include "net/url_request/url_fetcher.h" |
| 13 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
| 14 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 const char kServiceUrl[] = | 17 const char kServiceUrl[] = |
| 18 "https://www.googleapis.com/chromoting/v1/@me/hosts/"; | 18 "https://www.googleapis.com/chromoting/v1/@me/hosts/"; |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 namespace remoting { | 21 namespace remoting { |
| 22 | 22 |
| 23 class ServiceClient::Core | 23 class ServiceClient::Core |
| 24 : public base::RefCountedThreadSafe<ServiceClient::Core>, | 24 : public base::RefCountedThreadSafe<ServiceClient::Core>, |
| 25 public net::URLFetcherDelegate { | 25 public net::URLFetcherDelegate { |
| 26 public: | 26 public: |
| 27 Core(net::URLRequestContextGetter* request_context_getter) | 27 explicit Core(net::URLRequestContextGetter* request_context_getter) |
| 28 : request_context_getter_(request_context_getter), | 28 : request_context_getter_(request_context_getter), |
| 29 delegate_(NULL), | 29 delegate_(NULL), |
| 30 pending_request_type_(PENDING_REQUEST_NONE) { | 30 pending_request_type_(PENDING_REQUEST_NONE) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 void RegisterHost(const std::string& host_id, | 33 void RegisterHost(const std::string& host_id, |
| 34 const std::string& host_name, | 34 const std::string& host_name, |
| 35 const std::string& public_key, | 35 const std::string& public_key, |
| 36 const std::string& oauth_access_token, | 36 const std::string& oauth_access_token, |
| 37 ServiceClient::Delegate* delegate); | 37 ServiceClient::Delegate* delegate); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ServiceClient::UnregisterHost( | 160 void ServiceClient::UnregisterHost( |
| 161 const std::string& host_id, | 161 const std::string& host_id, |
| 162 const std::string& oauth_access_token, | 162 const std::string& oauth_access_token, |
| 163 Delegate* delegate) { | 163 Delegate* delegate) { |
| 164 return core_->UnregisterHost(host_id, oauth_access_token, delegate); | 164 return core_->UnregisterHost(host_id, oauth_access_token, delegate); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace gaia | 167 } // namespace gaia |
| OLD | NEW |