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

Unified Diff: components/signin/core/browser/dice_header_helper.cc

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/dice_header_helper.cc
diff --git a/components/signin/core/browser/dice_header_helper.cc b/components/signin/core/browser/dice_header_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6f146e810a33f145e80ab96e582731ef2d3e5f56
--- /dev/null
+++ b/components/signin/core/browser/dice_header_helper.cc
@@ -0,0 +1,31 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/signin/core/browser/dice_header_helper.h"
+
+#include "components/signin/core/common/profile_management_switches.h"
+#include "google_apis/gaia/gaia_auth_util.h"
+#include "google_apis/gaia/gaia_urls.h"
+#include "url/gurl.h"
+
+namespace signin {
+
+extern const char kDiceRequestHeader[] = "X-Chrome-ID-Consistency-Request";
+
+bool DiceHeaderHelper::IsUrlEligibleForRequestHeader(const GURL& url) {
+ if (switches::GetAccountConsistencyMethod() !=
+ switches::AccountConsistencyMethod::kDice) {
+ return false;
+ }
+ return gaia::IsGaiaSignonRealm(url.GetOrigin());
+}
+
+std::string DiceHeaderHelper::BuildRequestHeader(bool is_header_request,
+ const GURL& url,
+ const std::string& account_id,
+ int profile_mode_mask) {
+ return "client_id=" + GaiaUrls::GetInstance()->oauth2_chrome_client_id();
+}
+
+} // namespace signin

Powered by Google App Engine
This is Rietveld 408576698