#ifndef CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_
#define CHROME_BROWSER_SIGNIN_SIGNIN_HEADER_HELPER_H_
+#include <string>
+
namespace net {
class URLRequest;
}
namespace signin {
// Profile mode flags.
-enum PROFILE_MODE {
+enum ProfileMode {
PROFILE_MODE_DEFAULT = 0,
// Incognito mode disabled by enterprise policy or by parental controls.
PROFILE_MODE_INCOGNITO_DISABLED = 1 << 0,
PROFILE_MODE_ADD_ACCOUNT_DISABLED = 1 << 1
};
-// Add X-Chrome-Connected header to all Gaia requests from a connected profile,
+// The ServiceType specified by GAIA in the response header accompanying the 204
+// response. This indicates the action Chrome is supposed to lead the user to
+// perform.
+enum GAIAServiceType {
+ GAIA_SERVICE_TYPE_NONE = 0, // No GAIA response header.
+ GAIA_SERVICE_TYPE_SIGNOUT, // Logout all existing sessions.
+ GAIA_SERVICE_TYPE_INCOGNITO, // Open an incognito tab.
+ GAIA_SERVICE_TYPE_ADDSESSION, // Add a secondary account.
+ GAIA_SERVICE_TYPE_REAUTH, // Re-authenticate an account.
+ GAIA_SERVICE_TYPE_SIGNUP, // Create a new account.
+ GAIA_SERVICE_TYPE_DEFAULT, // All other cases.
+};
+
+// Struct describing the paramters received in the manage account header.
+struct ManageAccountsParams {
+ // The requested service type such as "ADDSESSION".
+ GAIAServiceType service_type;
+ // The prefilled email.
+ std::string email;
+ // Whether |email| is a saml account.
+ bool is_saml;
+ // The continue URL after the requested service is completed successfully.
+ // Defaults to the current URL if empty.
+ std::string continue_url;
+ // Whether the continue URL should be loaded in the same tab.
+ bool is_same_tab;
+ // The child id associated with the web content of the request.
+ int child_id;
+ // The route id associated with the web content of the request.
+ int route_id;
+
+ ManageAccountsParams();
+};
+
+// Adds X-Chrome-Connected header to all Gaia requests from a connected profile,
// with the exception of requests from gaia webview. Must be called on IO
// thread.
-void AppendMirrorRequestHeaderIfPossible(
+// Returns true if the account management header was added to the request.
+bool AppendMirrorRequestHeaderIfPossible(
net::URLRequest* request,
const GURL& redirect_url,
- ProfileIOData* io_data,
- int child_id,
- int route_id);
+ ProfileIOData* io_data);
// Looks for the X-Chrome-Manage-Accounts response header, and if found,
// tries to show the avatar bubble in the browser identified by the