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

Unified Diff: chrome/service/gaia/service_gaia_authenticator.h

Issue 2001009: Created a new process type called the service process to host background task... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.cc ('k') | chrome/service/gaia/service_gaia_authenticator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/gaia/service_gaia_authenticator.h
===================================================================
--- chrome/service/gaia/service_gaia_authenticator.h (revision 0)
+++ chrome/service/gaia/service_gaia_authenticator.h (revision 0)
@@ -0,0 +1,57 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_
+#define CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_
+
+#include <string>
+
+#include "base/ref_counted.h"
+#include "base/waitable_event.h"
+#include "chrome/common/net/url_fetcher.h"
+#include "chrome/common/net/gaia/gaia_authenticator.h"
+
+namespace base {
+class MessageLoopProxy;
+}
+
+// A GaiaAuthenticator implementation to be used in the service process (where
+// we cannot rely on the existence of a Profile)
+class ServiceGaiaAuthenticator
+ : public base::RefCountedThreadSafe<ServiceGaiaAuthenticator>,
+ public URLFetcher::Delegate,
+ public gaia::GaiaAuthenticator {
+ public:
+ ServiceGaiaAuthenticator(const std::string& user_agent,
+ const std::string& service_id,
+ const std::string& gaia_url,
+ base::MessageLoopProxy* io_message_loop_proxy);
+ ~ServiceGaiaAuthenticator();
+
+ // URLFetcher::Delegate implementation.
+ void OnURLFetchComplete(const URLFetcher *source, const GURL &url,
+ const URLRequestStatus &status, int response_code,
+ const ResponseCookies &cookies,
+ const std::string &data);
+
+ protected:
+ // GaiaAuthenticator overrides.
+ virtual bool Post(const GURL& url, const std::string& post_body,
+ unsigned long* response_code, std::string* response_body);
+ virtual int GetBackoffDelaySeconds(int current_backoff_delay);
+
+ private:
+ void DoPost(const GURL& post_url, const std::string& post_body);
+
+ base::WaitableEvent http_post_completed_;
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
+ int http_response_code_;
+ std::string response_data_;
+ scoped_ptr<URLFetcher> request_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceGaiaAuthenticator);
+};
+
+#endif // CHROME_SERVICE_GAIA_SERVICE_GAIA_AUTHENTICATOR_H_
+
Property changes on: chrome\service\gaia\service_gaia_authenticator.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.cc ('k') | chrome/service/gaia/service_gaia_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698