| 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 10 matching lines...) Expand all  Loading... | 
| 21 // we cannot rely on the existence of a Profile) | 21 // we cannot rely on the existence of a Profile) | 
| 22 class ServiceGaiaAuthenticator | 22 class ServiceGaiaAuthenticator | 
| 23     : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>, | 23     : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>, | 
| 24       public URLFetcher::Delegate, | 24       public URLFetcher::Delegate, | 
| 25       public gaia::GaiaAuthenticator { | 25       public gaia::GaiaAuthenticator { | 
| 26  public: | 26  public: | 
| 27   ServiceGaiaAuthenticator(const std::string& user_agent, | 27   ServiceGaiaAuthenticator(const std::string& user_agent, | 
| 28                            const std::string& service_id, | 28                            const std::string& service_id, | 
| 29                            const std::string& gaia_url, | 29                            const std::string& gaia_url, | 
| 30                            base::MessageLoopProxy* io_message_loop_proxy); | 30                            base::MessageLoopProxy* io_message_loop_proxy); | 
| 31   ~ServiceGaiaAuthenticator(); | 31   virtual ~ServiceGaiaAuthenticator(); | 
| 32 | 32 | 
| 33   // URLFetcher::Delegate implementation. | 33   // URLFetcher::Delegate implementation. | 
| 34   virtual void OnURLFetchComplete(const URLFetcher *source, | 34   virtual void OnURLFetchComplete(const URLFetcher *source, | 
| 35                                   const GURL &url, | 35                                   const GURL &url, | 
| 36                                   const net::URLRequestStatus &status, | 36                                   const net::URLRequestStatus &status, | 
| 37                                   int response_code, | 37                                   int response_code, | 
| 38                                   const net::ResponseCookies &cookies, | 38                                   const net::ResponseCookies &cookies, | 
| 39                                   const std::string &data); | 39                                   const std::string &data); | 
| 40 | 40 | 
| 41  protected: | 41  protected: | 
| 42   // GaiaAuthenticator overrides. | 42   // GaiaAuthenticator overrides. | 
| 43   virtual bool Post(const GURL& url, const std::string& post_body, | 43   virtual bool Post(const GURL& url, const std::string& post_body, | 
| 44                     unsigned long* response_code, std::string* response_body); | 44                     unsigned long* response_code, std::string* response_body); | 
| 45   virtual int GetBackoffDelaySeconds(int current_backoff_delay); | 45   virtual int GetBackoffDelaySeconds(int current_backoff_delay); | 
| 46 | 46 | 
| 47  private: | 47  private: | 
| 48   void DoPost(const GURL& post_url, const std::string& post_body); | 48   void DoPost(const GURL& post_url, const std::string& post_body); | 
| 49 | 49 | 
| 50   base::WaitableEvent http_post_completed_; | 50   base::WaitableEvent http_post_completed_; | 
| 51   scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 51   scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 
| 52   int http_response_code_; | 52   int http_response_code_; | 
| 53   std::string response_data_; | 53   std::string response_data_; | 
| 54 | 54 | 
| 55   DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator); | 55   DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator); | 
| 56 }; | 56 }; | 
| 57 | 57 | 
| 58 #endif  // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ | 58 #endif  // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ | 
| 59 | 59 | 
| OLD | NEW | 
|---|