Chromium Code Reviews| 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 } |
| 11 class GURL; | 11 class GURL; |
| 12 class ProfileIOData; | 12 class ProfileIOData; |
| 13 | 13 |
| 14 // Utility functions for handling Chrome/Gaia headers during signin process. | 14 // Utility functions for handling Chrome/Gaia headers during signin process. |
| 15 // In the Mirror world, Chrome identity should always stay in sync with Gaia | 15 // In the Mirror world, Chrome identity should always stay in sync with Gaia |
| 16 // identity. Therefore Chrome needs to send Gaia special header for requests | 16 // identity. Therefore Chrome needs to send Gaia special header for requests |
| 17 // from a connected profile, so that Gaia can modify its response accordingly | 17 // from a connected profile, so that Gaia can modify its response accordingly |
| 18 // and let Chrome handles signin with native UI. | 18 // and let Chrome handles signin with native UI. |
| 19 namespace signin { | 19 namespace signin { |
| 20 | 20 |
| 21 // Profile mode flags. | 21 // Profile mode flags. |
| 22 enum PROFILE_MODE { | 22 enum PROFILE_MODE { |
| 23 PROFILE_MODE_DEFAULT = 0, | 23 PROFILE_MODE_DEFAULT = 0, |
| 24 // Incognito mode disabled by enterprise policy or by parental controls. | 24 // Incognito mode disabled by enterprise policy or by parental controls. |
| 25 PROFILE_MODE_INCOGNITO_DISABLED = 1 << 0, | 25 PROFILE_MODE_INCOGNITO_DISABLED = 1 << 0, |
| 26 // Adding account disabled in the Android-for-EDU mode. | 26 // Adding account disabled in the Android-for-EDU mode. |
| 27 PROFILE_MODE_ADD_ACCOUNT_DISABLED = 1 << 1 | 27 PROFILE_MODE_ADD_ACCOUNT_DISABLED = 1 << 1 |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // The ServiceType specified by GAIA in the response header accompanying the 204 | |
| 31 // response. This indicates the action Chrome is supposed to lead the user to | |
| 32 // perform. | |
| 33 enum GAIA_SERVICE_TYPE { | |
|
sky
2014/05/23 19:55:22
This should be GaiaServiceType (or maybe GAIAServi
Mike Lerman
2014/05/23 20:13:04
Eek you're right. I had taken my example from abov
| |
| 34 GAIA_SERVICE_TYPE_NONE = 0, // No GAIA response header. | |
| 35 GAIA_SERVICE_TYPE_SIGNOUT, // Logout all existing sessions. | |
| 36 GAIA_SERVICE_TYPE_SIGNOUTOPTIONS_INCOGNITO, // Open an incognito tab. | |
| 37 GAIA_SERVICE_TYPE_ADDSESSION, // Add a secondary account. | |
| 38 GAIA_SERVICE_TYPE_REAUTH, // Re-authenticate an account. | |
| 39 GAIA_SERVICE_TYPE_DEFAULT, // All other cases. | |
| 40 }; | |
| 41 | |
| 30 // Add X-Chrome-Connected header to all Gaia requests from a connected profile, | 42 // Add X-Chrome-Connected header to all Gaia requests from a connected profile, |
| 31 // with the exception of requests from gaia webview. Must be called on IO | 43 // with the exception of requests from gaia webview. Must be called on IO |
| 32 // thread. | 44 // thread. |
| 33 void AppendMirrorRequestHeaderIfPossible( | 45 void AppendMirrorRequestHeaderIfPossible( |
| 34 net::URLRequest* request, | 46 net::URLRequest* request, |
| 35 const GURL& redirect_url, | 47 const GURL& redirect_url, |
| 36 ProfileIOData* io_data, | 48 ProfileIOData* io_data, |
| 37 int child_id, | 49 int child_id, |
| 38 int route_id); | 50 int route_id); |
| 39 | 51 |
| 40 // Looks for the X-Chrome-Manage-Accounts response header, and if found, | 52 // Looks for the X-Chrome-Manage-Accounts response header, and if found, |
| 41 // tries to show the avatar bubble in the browser identified by the | 53 // tries to show the avatar bubble in the browser identified by the |
| 42 // child/route id. Must be called on IO thread. | 54 // child/route id. Must be called on IO thread. |
| 43 void ProcessMirrorResponseHeaderIfExists( | 55 void ProcessMirrorResponseHeaderIfExists( |
| 44 net::URLRequest* request, | 56 net::URLRequest* request, |
| 45 ProfileIOData* io_data, | 57 ProfileIOData* io_data, |
| 46 int child_id, | 58 int child_id, |
| 47 int route_id); | 59 int route_id); |
| 48 | 60 |
| 49 }; // namespace signin | 61 }; // namespace signin |
| 50 | 62 |
| 51 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ | 63 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_ |
| OLD | NEW |