Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: components/signin/core/browser/signin_header_helper.h

Issue 2918403009: [Dice] Parse the Dice response header (Closed)
Patch Set: Remove logout url Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/signin/core/browser/signin_header_helper.h
diff --git a/components/signin/core/browser/signin_header_helper.h b/components/signin/core/browser/signin_header_helper.h
index 948d8718c90dd3371c399001b4dc478fe9a9fdea..1f06afc4caf906db001e15607c1a7a885928d626 100644
--- a/components/signin/core/browser/signin_header_helper.h
+++ b/components/signin/core/browser/signin_header_helper.h
@@ -9,6 +9,7 @@
#include <string>
#include "build/build_config.h"
+#include "url/gurl.h"
namespace content_settings {
class CookieSettings;
@@ -18,8 +19,6 @@ namespace net {
class URLRequest;
}
-class GURL;
-
namespace signin {
// Profile mode flags.
@@ -47,7 +46,14 @@ enum GAIAServiceType {
GAIA_SERVICE_TYPE_DEFAULT, // All other cases.
};
-// Struct describing the paramters received in the manage account header.
+enum class DiceAction {
+ NONE,
+ SIGNIN, // Sign in an account.
+ SIGNOUT, // Sign out of all sessions.
+ SINGLE_SESSION_SIGNOUT // Sign out of a single session.
+};
+
+// Struct describing the parameters received in the manage account header.
struct ManageAccountsParams {
// The requested service type such as "ADDSESSION".
GAIAServiceType service_type;
@@ -73,6 +79,31 @@ struct ManageAccountsParams {
ManageAccountsParams(const ManageAccountsParams& other);
};
+// Struct describing the parameters received in the Dice response header.
+struct DiceResponseParams {
+ DiceResponseParams();
+ ~DiceResponseParams();
+ DiceResponseParams(const DiceResponseParams& other);
+
+ DiceAction user_intention;
+
+ // Gaia ID of the account signed in or signed out (which may be a secondary
+ // account). When |user_intention| is SIGNOUT, this is the ID of the primary
+ // account.
+ std::string obfuscated_gaia_id;
+
+ // Email of the account signed in or signed out. When |user_intention| is
+ // SIGNOUT, this is the email of the primary account.
+ std::string email;
+
+ // Session index for the account signed in or signed out. When
+ // |user_intention| is SIGNOUT, this is 0.
+ int session_index;
+
+ // Optional. Must be set when |user_intention| is SIGNIN.
+ std::string authorization_code;
+};
+
// Base class for managing the signin headers (Dice and Chrome-Connected).
class SigninHeaderHelper {
public:
@@ -146,6 +177,14 @@ void AppendOrRemoveAccountConsistentyRequestHeader(
// header.
ManageAccountsParams BuildManageAccountsParams(const std::string& header_value);
+#if !defined(OS_IOS) && !defined(OS_ANDROID)
+// Returns the parameters contained in the X-Chrome-ID-Consistency-Response
+// response header.
+// Returns DiceAction::NONE in case of error (such as missing or malformed
+// parameters).
+DiceResponseParams BuildDiceResponseParams(const std::string& header_value);
+#endif
+
} // namespace signin
#endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_HEADER_HELPER_H_
« no previous file with comments | « components/signin/core/browser/dice_header_helper.cc ('k') | components/signin/core/browser/signin_header_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698