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

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

Issue 2923733003: [signin] Add DICe flow for account consistency requests. (Closed)
Patch Set: Add test for Dice disabled 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 4e02a0c73f7f7288d1d66e1c98c600874d6c540a..2ec56a3bac053f0a107ba0c4bfd56f15090e922f 100644
--- a/components/signin/core/browser/signin_header_helper.h
+++ b/components/signin/core/browser/signin_header_helper.h
@@ -30,8 +30,6 @@ enum ProfileMode {
PROFILE_MODE_ADD_ACCOUNT_DISABLED = 1 << 1
};
-extern const char kChromeConnectedHeader[];
-
// 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.
@@ -71,22 +69,50 @@ struct ManageAccountsParams {
ManageAccountsParams(const ManageAccountsParams& other);
};
+// Base class for managing the signin headers (Dice and Chrome-Connected).
+class SigninHeaderHelper {
+ public:
+ // Appends or remove the header to a network request if necessary.
+ bool AppendOrRemoveRequestHeader(
+ net::URLRequest* request,
+ const char* header_name,
+ const GURL& redirect_url,
+ const std::string& account_id,
+ const content_settings::CookieSettings* cookie_settings,
+ int profile_mode_mask);
+
+ protected:
+ // Returns the value of the request header, or empty if the header should not
+ // be added. Calls into BuildRequestHeader() which is customized by
+ // subclasses.
+ std::string BuildRequestHeaderIfPossible(
+ bool is_header_request,
+ const GURL& url,
+ const std::string& account_id,
+ const content_settings::CookieSettings* cookie_settings,
+ int profile_mode_mask);
+
+ private:
+ // Returns whether the url is eligible for the request header.
+ virtual bool IsUrlEligibleForRequestHeader(const GURL& url) = 0;
+
+ // Returns the value of the request header, or empty if the header should not
+ // be added.
+ // The request is assumed to be eligible.
+ virtual std::string BuildRequestHeader(bool is_header_request,
+ const GURL& url,
+ const std::string& account_id,
+ int profile_mode_mask) = 0;
+};
+
// Returns true if signin cookies are allowed.
bool SettingsAllowSigninCookies(
const content_settings::CookieSettings* cookie_settings);
msarda 2017/06/08 23:43:05 I think it would be good to continue to have the f
droger 2017/06/09 09:52:24 Done.
-// Returns the CHROME_CONNECTED cookie, or an empty string if it should not be
-// added to the request to |url|.
-std::string BuildMirrorRequestCookieIfPossible(
- const GURL& url,
- const std::string& account_id,
- const content_settings::CookieSettings* cookie_settings,
- int profile_mode_mask);
-
// Adds account consistency header to all Gaia requests from a connected
// profile, with the exception of requests from gaia webview.
// Removes the header in case it should not be transfered to a redirected url.
-bool AppendOrRemoveAccountConsistentyRequestHeader(
+void AppendOrRemoveAccountConsistentyRequestHeader(
net::URLRequest* request,
const GURL& redirect_url,
const std::string& account_id,

Powered by Google App Engine
This is Rietveld 408576698