OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SIGNIN_SIGNIN_HEADER_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ |
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ | 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ |
7 | 7 |
8 namespace net { | 8 namespace net { |
9 class URLRequest; | 9 class URLRequest; |
10 } | 10 } |
(...skipping 21 matching lines...) Expand all Loading... |
32 // perform. | 32 // perform. |
33 enum GAIAServiceType { | 33 enum GAIAServiceType { |
34 GAIA_SERVICE_TYPE_NONE = 0, // No GAIA response header. | 34 GAIA_SERVICE_TYPE_NONE = 0, // No GAIA response header. |
35 GAIA_SERVICE_TYPE_SIGNOUT, // Logout all existing sessions. | 35 GAIA_SERVICE_TYPE_SIGNOUT, // Logout all existing sessions. |
36 GAIA_SERVICE_TYPE_INCOGNITO, // Open an incognito tab. | 36 GAIA_SERVICE_TYPE_INCOGNITO, // Open an incognito tab. |
37 GAIA_SERVICE_TYPE_ADDSESSION, // Add a secondary account. | 37 GAIA_SERVICE_TYPE_ADDSESSION, // Add a secondary account. |
38 GAIA_SERVICE_TYPE_REAUTH, // Re-authenticate an account. | 38 GAIA_SERVICE_TYPE_REAUTH, // Re-authenticate an account. |
39 GAIA_SERVICE_TYPE_DEFAULT, // All other cases. | 39 GAIA_SERVICE_TYPE_DEFAULT, // All other cases. |
40 }; | 40 }; |
41 | 41 |
42 // Add X-Chrome-Connected header to all Gaia requests from a connected profile, | 42 // Struct describing the paramters received in the manage account header. |
| 43 struct ManageAccountsParams { |
| 44 GAIAServiceType service_type; |
| 45 }; |
| 46 |
| 47 // Adds X-Chrome-Connected header to all Gaia requests from a connected profile, |
43 // with the exception of requests from gaia webview. Must be called on IO | 48 // with the exception of requests from gaia webview. Must be called on IO |
44 // thread. | 49 // thread. |
45 void AppendMirrorRequestHeaderIfPossible( | 50 // Returns true if the account management header was added to the request. |
| 51 bool AppendMirrorRequestHeaderIfPossible( |
46 net::URLRequest* request, | 52 net::URLRequest* request, |
47 const GURL& redirect_url, | 53 const GURL& redirect_url, |
48 ProfileIOData* io_data, | 54 ProfileIOData* io_data, |
49 int child_id, | 55 int child_id, |
50 int route_id); | 56 int route_id); |
51 | 57 |
| 58 // Returns the parameters contained in the X-Chrome-Manage-Accounts response |
| 59 // header. |
| 60 // If the request does not have a response header or if the header contains |
| 61 // garbage, then |service_type| is set to |GAIA_SERVICE_TYPE_NONE|. |
| 62 // Must be called on IO thread. |
| 63 ManageAccountsParams GetManageAccountsParams(net::URLRequest* request, |
| 64 ProfileIOData* io_data); |
| 65 |
52 // Looks for the X-Chrome-Manage-Accounts response header, and if found, | 66 // Looks for the X-Chrome-Manage-Accounts response header, and if found, |
53 // tries to show the avatar bubble in the browser identified by the | 67 // tries to show the avatar bubble in the browser identified by the |
54 // child/route id. Must be called on IO thread. | 68 // child/route id. Must be called on IO thread. |
55 void ProcessMirrorResponseHeaderIfExists( | 69 void ProcessMirrorResponseHeaderIfExists( |
56 net::URLRequest* request, | 70 net::URLRequest* request, |
57 ProfileIOData* io_data, | 71 ProfileIOData* io_data, |
58 int child_id, | 72 int child_id, |
59 int route_id); | 73 int route_id); |
60 | 74 |
61 }; // namespace signin | 75 }; // namespace signin |
62 | 76 |
63 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ | 77 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ |
OLD | NEW |