| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ | 5 #ifndef CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ |
| 6 #define CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ | 6 #define CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // we cannot rely on the existence of a Profile) | 22 // we cannot rely on the existence of a Profile) |
| 23 class ServiceGaiaAuthenticator | 23 class ServiceGaiaAuthenticator |
| 24 : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>, | 24 : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>, |
| 25 public content::URLFetcherDelegate, | 25 public content::URLFetcherDelegate, |
| 26 public gaia::GaiaAuthenticator { | 26 public gaia::GaiaAuthenticator { |
| 27 public: | 27 public: |
| 28 ServiceGaiaAuthenticator(const std::string& user_agent, | 28 ServiceGaiaAuthenticator(const std::string& user_agent, |
| 29 const std::string& service_id, | 29 const std::string& service_id, |
| 30 const std::string& gaia_url, | 30 const std::string& gaia_url, |
| 31 base::MessageLoopProxy* io_message_loop_proxy); | 31 base::MessageLoopProxy* io_message_loop_proxy); |
| 32 virtual ~ServiceGaiaAuthenticator(); | |
| 33 | 32 |
| 34 // content::URLFetcherDelegate implementation. | 33 // content::URLFetcherDelegate implementation. |
| 35 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; | 34 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 36 | 35 |
| 37 protected: | 36 protected: |
| 38 // GaiaAuthenticator overrides. | 37 // GaiaAuthenticator overrides. |
| 39 virtual bool Post(const GURL& url, | 38 virtual bool Post(const GURL& url, |
| 40 const std::string& post_body, | 39 const std::string& post_body, |
| 41 unsigned long* response_code, | 40 unsigned long* response_code, |
| 42 std::string* response_body) OVERRIDE; | 41 std::string* response_body) OVERRIDE; |
| 43 virtual int GetBackoffDelaySeconds(int current_backoff_delay) OVERRIDE; | 42 virtual int GetBackoffDelaySeconds(int current_backoff_delay) OVERRIDE; |
| 44 | 43 |
| 45 private: | 44 private: |
| 45 friend class base::RefCountedThreadSafe<ServiceGaiaAuthenticator>; |
| 46 virtual ~ServiceGaiaAuthenticator(); |
| 47 |
| 46 void DoPost(const GURL& post_url, const std::string& post_body); | 48 void DoPost(const GURL& post_url, const std::string& post_body); |
| 47 | 49 |
| 48 base::WaitableEvent http_post_completed_; | 50 base::WaitableEvent http_post_completed_; |
| 49 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 51 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 50 int http_response_code_; | 52 int http_response_code_; |
| 51 std::string response_data_; | 53 std::string response_data_; |
| 52 | 54 |
| 53 DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator); | 55 DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator); |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 #endif // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ | 58 #endif // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ |
| OLD | NEW |