| 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/gaia_oauth_client.h" | 5 #include "remoting/host/gaia_oauth_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 | 26 |
| 27 class GaiaOAuthClient::Core | 27 class GaiaOAuthClient::Core |
| 28 : public base::RefCountedThreadSafe<GaiaOAuthClient::Core> { | 28 : public base::RefCountedThreadSafe<GaiaOAuthClient::Core> { |
| 29 public: | 29 public: |
| 30 Core(const std::string& gaia_url, | 30 Core(const std::string& gaia_url, |
| 31 net::URLRequestContextGetter* request_context_getter) | 31 net::URLRequestContextGetter* request_context_getter) |
| 32 : gaia_url_(gaia_url), | 32 : gaia_url_(gaia_url), |
| 33 request_context_getter_(request_context_getter), | 33 request_context_getter_(request_context_getter), |
| 34 delegate_(NULL) { } | 34 delegate_(NULL) { |
| 35 | 35 } |
| 36 virtual ~Core() { } | |
| 37 | 36 |
| 38 void RefreshToken(const OAuthClientInfo& oauth_client_info, | 37 void RefreshToken(const OAuthClientInfo& oauth_client_info, |
| 39 const std::string& refresh_token, | 38 const std::string& refresh_token, |
| 40 GaiaOAuthClient::Delegate* delegate); | 39 GaiaOAuthClient::Delegate* delegate); |
| 41 | 40 |
| 42 private: | 41 private: |
| 42 friend class base::RefCountedThreadSafe<Core>; |
| 43 virtual ~Core() {} |
| 44 |
| 43 void OnUrlFetchComplete(const net::URLRequestStatus& status, | 45 void OnUrlFetchComplete(const net::URLRequestStatus& status, |
| 44 int response_code, | 46 int response_code, |
| 45 const std::string& response); | 47 const std::string& response); |
| 46 | 48 |
| 47 GURL gaia_url_; | 49 GURL gaia_url_; |
| 48 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 50 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 49 GaiaOAuthClient::Delegate* delegate_; | 51 GaiaOAuthClient::Delegate* delegate_; |
| 50 scoped_ptr<UrlFetcher> request_; | 52 scoped_ptr<UrlFetcher> request_; |
| 51 }; | 53 }; |
| 52 | 54 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 128 |
| 127 void GaiaOAuthClient::RefreshToken(const OAuthClientInfo& oauth_client_info, | 129 void GaiaOAuthClient::RefreshToken(const OAuthClientInfo& oauth_client_info, |
| 128 const std::string& refresh_token, | 130 const std::string& refresh_token, |
| 129 Delegate* delegate) { | 131 Delegate* delegate) { |
| 130 return core_->RefreshToken(oauth_client_info, | 132 return core_->RefreshToken(oauth_client_info, |
| 131 refresh_token, | 133 refresh_token, |
| 132 delegate); | 134 delegate); |
| 133 } | 135 } |
| 134 | 136 |
| 135 } // namespace remoting | 137 } // namespace remoting |
| OLD | NEW |