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_BROWSER_CHROMEOS_LOGIN_CLIENT_LOGIN_RESPONSE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_CLIENT_LOGIN_RESPONSE_HANDLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CLIENT_LOGIN_RESPONSE_HANDLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_CLIENT_LOGIN_RESPONSE_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
12 #include "chrome/browser/chromeos/login/auth_response_handler.h" | 13 #include "chrome/browser/chromeos/login/auth_response_handler.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 class URLRequestContextGetter; | 16 class URLRequestContextGetter; |
16 } | 17 } |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 // Handles responses to a fetch executed upon the Google Accounts ClientLogin | 21 // Handles responses to a fetch executed upon the Google Accounts ClientLogin |
21 // endpoint. The cookies that are sent back in the response body are | 22 // endpoint. The cookies that are sent back in the response body are |
22 // reformatted into a request for an time-limited authorization token, which | 23 // reformatted into a request for an time-limited authorization token, which |
23 // is then sent to the IssueAuthToken endpoint. | 24 // is then sent to the IssueAuthToken endpoint. |
24 class ClientLoginResponseHandler : public AuthResponseHandler { | 25 class ClientLoginResponseHandler : public AuthResponseHandler { |
25 public: | 26 public: |
26 explicit ClientLoginResponseHandler(net::URLRequestContextGetter* getter) | 27 explicit ClientLoginResponseHandler(net::URLRequestContextGetter* getter) |
27 : getter_(getter) {} | 28 : getter_(getter) {} |
28 virtual ~ClientLoginResponseHandler() {} | 29 virtual ~ClientLoginResponseHandler() {} |
29 | 30 |
30 // Overridden from AuthResponseHandler. | 31 // Overridden from AuthResponseHandler. |
31 virtual bool CanHandle(const GURL& url); | 32 virtual bool CanHandle(const GURL& url) OVERRIDE; |
32 | 33 |
33 // Overridden from AuthResponseHandler. | 34 // Overridden from AuthResponseHandler. |
34 // Takes in a response from ClientLogin, formats into an appropriate query | 35 // Takes in a response from ClientLogin, formats into an appropriate query |
35 // to sent to IssueAuthToken and issues said query. |catcher| will receive | 36 // to sent to IssueAuthToken and issues said query. |catcher| will receive |
36 // the response to the fetch. | 37 // the response to the fetch. |
37 virtual content::URLFetcher* Handle(const std::string& to_process, | 38 virtual content::URLFetcher* Handle( |
38 content::URLFetcherDelegate* catcher); | 39 const std::string& to_process, |
| 40 content::URLFetcherDelegate* catcher) OVERRIDE; |
39 | 41 |
40 // exposed for tests. | 42 // exposed for tests. |
41 std::string payload() { return payload_; } | 43 std::string payload() { return payload_; } |
42 | 44 |
43 // A string that tells the Accounts backend to which service we're trying to | 45 // A string that tells the Accounts backend to which service we're trying to |
44 // authenticate. | 46 // authenticate. |
45 static const char kService[]; | 47 static const char kService[]; |
46 private: | 48 private: |
47 std::string payload_; | 49 std::string payload_; |
48 net::URLRequestContextGetter* getter_; | 50 net::URLRequestContextGetter* getter_; |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(ClientLoginResponseHandler); | 52 DISALLOW_COPY_AND_ASSIGN(ClientLoginResponseHandler); |
51 }; | 53 }; |
52 | 54 |
53 } // namespace chromeos | 55 } // namespace chromeos |
54 | 56 |
55 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CLIENT_LOGIN_RESPONSE_HANDLER_H_ | 57 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_CLIENT_LOGIN_RESPONSE_HANDLER_H_ |
OLD | NEW |