Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: chrome/service/gaia/service_gaia_authenticator.h

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
13 #include "chrome/common/net/gaia/gaia_authenticator.h" 14 #include "chrome/common/net/gaia/gaia_authenticator.h"
14 #include "content/common/net/url_fetcher.h" 15 #include "content/public/common/url_fetcher_delegate.h"
15 16
16 namespace base { 17 namespace base {
17 class MessageLoopProxy; 18 class MessageLoopProxy;
18 } 19 }
19 20
20 // A GaiaAuthenticator implementation to be used in the service process (where 21 // A GaiaAuthenticator implementation to be used in the service process (where
21 // we cannot rely on the existence of a Profile) 22 // we cannot rely on the existence of a Profile)
22 class ServiceGaiaAuthenticator 23 class ServiceGaiaAuthenticator
23 : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>, 24 : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>,
24 public URLFetcher::Delegate, 25 public content::URLFetcherDelegate,
25 public gaia::GaiaAuthenticator { 26 public gaia::GaiaAuthenticator {
26 public: 27 public:
27 ServiceGaiaAuthenticator(const std::string& user_agent, 28 ServiceGaiaAuthenticator(const std::string& user_agent,
28 const std::string& service_id, 29 const std::string& service_id,
29 const std::string& gaia_url, 30 const std::string& gaia_url,
30 base::MessageLoopProxy* io_message_loop_proxy); 31 base::MessageLoopProxy* io_message_loop_proxy);
31 virtual ~ServiceGaiaAuthenticator(); 32 virtual ~ServiceGaiaAuthenticator();
32 33
33 // URLFetcher::Delegate implementation. 34 // content::URLFetcherDelegate implementation.
34 virtual void OnURLFetchComplete(const URLFetcher *source) OVERRIDE; 35 virtual void OnURLFetchComplete(const URLFetcher *source) OVERRIDE;
35 36
36 protected: 37 protected:
37 // GaiaAuthenticator overrides. 38 // GaiaAuthenticator overrides.
38 virtual bool Post(const GURL& url, const std::string& post_body, 39 virtual bool Post(const GURL& url, const std::string& post_body,
39 unsigned long* response_code, std::string* response_body); 40 unsigned long* response_code, std::string* response_body);
40 virtual int GetBackoffDelaySeconds(int current_backoff_delay); 41 virtual int GetBackoffDelaySeconds(int current_backoff_delay);
41 42
42 private: 43 private:
43 void DoPost(const GURL& post_url, const std::string& post_body); 44 void DoPost(const GURL& post_url, const std::string& post_body);
44 45
45 base::WaitableEvent http_post_completed_; 46 base::WaitableEvent http_post_completed_;
46 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 47 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
47 int http_response_code_; 48 int http_response_code_;
48 std::string response_data_; 49 std::string response_data_;
49 50
50 DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator); 51 DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator);
51 }; 52 };
52 53
53 #endif // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_ 54 #endif // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698