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

Side by Side Diff: components/signin/core/browser/dice_header_helper.cc

Issue 2944383006: [Signin] Rename obfuscated_gaia_id into gaia_id (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/signin/core/browser/dice_header_helper.h" 5 #include "components/signin/core/browser/dice_header_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 DiceResponseParams params; 43 DiceResponseParams params;
44 ResponseHeaderDictionary header_dictionary = 44 ResponseHeaderDictionary header_dictionary =
45 ParseAccountConsistencyResponseHeader(header_value); 45 ParseAccountConsistencyResponseHeader(header_value);
46 ResponseHeaderDictionary::const_iterator it = header_dictionary.begin(); 46 ResponseHeaderDictionary::const_iterator it = header_dictionary.begin();
47 for (; it != header_dictionary.end(); ++it) { 47 for (; it != header_dictionary.end(); ++it) {
48 const std::string key_name(it->first); 48 const std::string key_name(it->first);
49 const std::string value(it->second); 49 const std::string value(it->second);
50 if (key_name == kActionAttrName) { 50 if (key_name == kActionAttrName) {
51 params.user_intention = GetDiceActionFromHeader(value); 51 params.user_intention = GetDiceActionFromHeader(value);
52 } else if (key_name == kIdAttrName) { 52 } else if (key_name == kIdAttrName) {
53 params.obfuscated_gaia_id = value; 53 params.gaia_id = value;
54 } else if (key_name == kEmailAttrName) { 54 } else if (key_name == kEmailAttrName) {
55 params.email = value; 55 params.email = value;
56 } else if (key_name == kAuthUserAttrName) { 56 } else if (key_name == kAuthUserAttrName) {
57 bool parse_success = base::StringToInt(value, &params.session_index); 57 bool parse_success = base::StringToInt(value, &params.session_index);
58 if (!parse_success) 58 if (!parse_success)
59 params.session_index = -1; 59 params.session_index = -1;
60 } else if (key_name == kAuthorizationCodeAttrName) { 60 } else if (key_name == kAuthorizationCodeAttrName) {
61 params.authorization_code = value; 61 params.authorization_code = value;
62 } else { 62 } else {
63 DLOG(WARNING) << "Unexpected Gaia header attribute '" << key_name << "'."; 63 DLOG(WARNING) << "Unexpected Gaia header attribute '" << key_name << "'.";
64 } 64 }
65 } 65 }
66 66
67 if (params.obfuscated_gaia_id.empty() || params.email.empty() || 67 if (params.gaia_id.empty() || params.email.empty() ||
68 params.session_index == -1) { 68 params.session_index == -1) {
69 DLOG(WARNING) << "Missing parameters for Dice header."; 69 DLOG(WARNING) << "Missing parameters for Dice header.";
70 params.user_intention = DiceAction::NONE; 70 params.user_intention = DiceAction::NONE;
71 } 71 }
72 72
73 if (params.user_intention == DiceAction::SIGNIN && 73 if (params.user_intention == DiceAction::SIGNIN &&
74 params.authorization_code.empty()) { 74 params.authorization_code.empty()) {
75 DLOG(WARNING) << "Missing authorization code for Dice SIGNIN."; 75 DLOG(WARNING) << "Missing authorization code for Dice SIGNIN.";
76 params.user_intention = DiceAction::NONE; 76 params.user_intention = DiceAction::NONE;
77 } 77 }
(...skipping 13 matching lines...) Expand all
91 bool sync_enabled) { 91 bool sync_enabled) {
92 std::vector<std::string> parts; 92 std::vector<std::string> parts;
93 parts.push_back("client_id=" + 93 parts.push_back("client_id=" +
94 GaiaUrls::GetInstance()->oauth2_chrome_client_id()); 94 GaiaUrls::GetInstance()->oauth2_chrome_client_id());
95 if (sync_enabled) 95 if (sync_enabled)
96 parts.push_back("sync_account_id=" + account_id); 96 parts.push_back("sync_account_id=" + account_id);
97 return base::JoinString(parts, ","); 97 return base::JoinString(parts, ",");
98 } 98 }
99 99
100 } // namespace signin 100 } // namespace signin
OLDNEW
« no previous file with comments | « chrome/browser/signin/dice_response_handler_unittest.cc ('k') | components/signin/core/browser/signin_header_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698