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_CHROME_SIGNIN_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_HELPER_H_ |
6 #define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_HELPER_H_ | 6 #define CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 class URLRequest; | 11 class URLRequest; |
12 } | 12 } |
13 class GURL; | 13 class GURL; |
14 class ProfileIOData; | 14 class ProfileIOData; |
15 | 15 |
16 // Utility functions for handling Chrome/Gaia headers during signin process. | 16 // Utility functions for handling Chrome/Gaia headers during signin process. |
17 // In the Mirror world, Chrome identity should always stay in sync with Gaia | 17 // In the Mirror world, Chrome identity should always stay in sync with Gaia |
18 // identity. Therefore Chrome needs to send Gaia special header for requests | 18 // identity. Therefore Chrome needs to send Gaia special header for requests |
19 // from a connected profile, so that Gaia can modify its response accordingly | 19 // from a connected profile, so that Gaia can modify its response accordingly |
20 // and let Chrome handles signin with native UI. | 20 // and let Chrome handles signin with native UI. |
21 namespace signin { | 21 namespace signin { |
22 | 22 |
23 // Adds X-Chrome-Connected header to all Gaia requests from a connected profile, | 23 // Adds X-Chrome-Connected header to all Gaia requests from a connected profile, |
24 // with the exception of requests from gaia webview. Must be called on IO | 24 // with the exception of requests from gaia webview. Must be called on IO |
25 // thread. | 25 // thread. |
26 // Returns true if the account management header was added to the request. | 26 // Returns true if the account management header was added to the request. |
27 bool AppendMirrorRequestHeaderHelper(net::URLRequest* request, | 27 // Removes X-Chrome-Connected header if it is already in the headers and |
28 const GURL& redirect_url, | 28 // it should not be there. |
29 ProfileIOData* io_data, | 29 void FixMirrorRequestHeaderHelper(net::URLRequest* request, |
30 int child_id, | 30 const GURL& redirect_url, |
31 int route_id); | 31 ProfileIOData* io_data, |
| 32 int child_id, |
| 33 int route_id); |
32 | 34 |
33 // Looks for the X-Chrome-Manage-Accounts response header, and if found, | 35 // Looks for the X-Chrome-Manage-Accounts response header, and if found, |
34 // tries to show the avatar bubble in the browser identified by the | 36 // tries to show the avatar bubble in the browser identified by the |
35 // child/route id. Must be called on IO thread. | 37 // child/route id. Must be called on IO thread. |
36 void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request, | 38 void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request, |
37 ProfileIOData* io_data, | 39 ProfileIOData* io_data, |
38 int child_id, | 40 int child_id, |
39 int route_id); | 41 int route_id); |
40 | 42 |
41 }; // namespace signin | 43 }; // namespace signin |
42 | 44 |
43 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_HELPER_H_ | 45 #endif // CHROME_BROWSER_SIGNIN_CHROME_SIGNIN_HELPER_H_ |
OLD | NEW |