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

Unified Diff: chrome/browser/signin/chrome_signin_helper.cc

Issue 2918403009: [Dice] Parse the Dice response header (Closed)
Patch Set: rebase 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: chrome/browser/signin/chrome_signin_helper.cc
diff --git a/chrome/browser/signin/chrome_signin_helper.cc b/chrome/browser/signin/chrome_signin_helper.cc
index f7d08b67d319e34d330c25d438a1ac127db9d0e9..bf4431cbb779e0be7588b25532a936c760082342 100644
--- a/chrome/browser/signin/chrome_signin_helper.cc
+++ b/chrome/browser/signin/chrome_signin_helper.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/signin/chrome_signin_helper.h"
#include "base/strings/string_util.h"
-#include "build/build_config.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
@@ -37,6 +36,7 @@ namespace signin {
namespace {
const char kChromeManageAccountsHeader[] = "X-Chrome-Manage-Accounts";
+const char kDiceResponseHeader[] = "X-Chrome-ID-Consistency-Response";
// Processes the mirror response header on the UI thread. Currently depending
// on the value of |header_value|, it either shows the profile avatar menu, or
@@ -183,4 +183,45 @@ void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request,
base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params));
}
+#if !defined(OS_IOS) && !defined(OS_ANDROID)
+void ProcessDiceResponseHeaderIfExists(net::URLRequest* request,
+ ProfileIOData* io_data) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+ if (io_data->IsOffTheRecord())
+ return;
+
+ const content::ResourceRequestInfo* info =
+ content::ResourceRequestInfo::ForRequest(request);
+ if (!(info && info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME))
+ return;
+
+ if (!gaia::IsGaiaSignonRealm(request->url().GetOrigin()))
+ return;
+
+ if (switches::GetAccountConsistencyMethod() !=
+ switches::AccountConsistencyMethod::kDice) {
+ return;
+ }
+
+ net::HttpResponseHeaders* response_headers = request->response_headers();
+ if (!response_headers)
+ return;
+
+ std::string header_value;
+ if (!response_headers->GetNormalizedHeader(kDiceResponseHeader,
+ &header_value)) {
+ return;
+ }
+
+ DiceResponseParams params = BuildDiceResponseParams(header_value);
+ // If the request does not have a response header or if the header contains
+ // garbage, then |user_intention| is set to |NONE|.
+ if (params.user_intention == DiceAction::NONE)
+ return;
+
+ // TODO(droger): Start the Chrome authentication flow.
msarda 2017/06/12 11:52:21 This TODO is wrong as we do not plan to start an a
droger 2017/06/12 12:39:14 Done.
+}
+#endif // !defined(OS_IOS) && !defined(OS_ANDROID)
+
} // namespace signin

Powered by Google App Engine
This is Rietveld 408576698