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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_
10 namespace content_settings
{
22 // Profile mode flags.
24 PROFILE_MODE_DEFAULT
= 0,
25 // Incognito mode disabled by enterprise policy or by parental controls.
26 PROFILE_MODE_INCOGNITO_DISABLED
= 1 << 0,
27 // Adding account disabled in the Android-for-EDU mode.
28 PROFILE_MODE_ADD_ACCOUNT_DISABLED
= 1 << 1
31 // The ServiceType specified by GAIA in the response header accompanying the 204
32 // response. This indicates the action Chrome is supposed to lead the user to
34 enum GAIAServiceType
{
35 GAIA_SERVICE_TYPE_NONE
= 0, // No GAIA response header.
36 GAIA_SERVICE_TYPE_SIGNOUT
, // Logout all existing sessions.
37 GAIA_SERVICE_TYPE_INCOGNITO
, // Open an incognito tab.
38 GAIA_SERVICE_TYPE_ADDSESSION
, // Add a secondary account.
39 GAIA_SERVICE_TYPE_REAUTH
, // Re-authenticate an account.
40 GAIA_SERVICE_TYPE_SIGNUP
, // Create a new account.
41 GAIA_SERVICE_TYPE_DEFAULT
, // All other cases.
44 // Struct describing the paramters received in the manage account header.
45 struct ManageAccountsParams
{
46 // The requested service type such as "ADDSESSION".
47 GAIAServiceType service_type
;
48 // The prefilled email.
50 // Whether |email| is a saml account.
52 // The continue URL after the requested service is completed successfully.
53 // Defaults to the current URL if empty.
54 std::string continue_url
;
55 // Whether the continue URL should be loaded in the same tab.
58 // iOS has no notion of route and child IDs.
60 // The child id associated with the web content of the request.
62 // The route id associated with the web content of the request.
64 #endif // !defined(OS_IOS)
66 ManageAccountsParams();
69 // Returns true if signin cookies are allowed.
70 bool SettingsAllowSigninCookies(
71 content_settings::CookieSettings
* cookie_settings
);
73 // Adds X-Chrome-Connected header to all Gaia requests from a connected profile,
74 // with the exception of requests from gaia webview.
75 // Returns true if the account management header was added to the request.
76 bool AppendMirrorRequestHeaderIfPossible(
77 net::URLRequest
* request
,
78 const GURL
& redirect_url
,
79 const std::string
& account_id
,
80 content_settings::CookieSettings
* cookie_settings
,
81 int profile_mode_mask
);
83 // Returns the parameters contained in the X-Chrome-Manage-Accounts response
85 // If the request does not have a response header or if the header contains
86 // garbage, then |service_type| is set to |GAIA_SERVICE_TYPE_NONE|.
87 ManageAccountsParams
BuildManageAccountsParamsIfExists(net::URLRequest
* request
,
88 bool is_off_the_record
);
92 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_