| Index: chrome/browser/ui/auto_login_prompter.cc
|
| diff --git a/chrome/browser/ui/auto_login_prompter.cc b/chrome/browser/ui/auto_login_prompter.cc
|
| index a0dcce0e7fe27bbe1f7be15b0c4afa55eb2f8c81..ad69cd7e764fea3893df353e841e8a05b59a006e 100644
|
| --- a/chrome/browser/ui/auto_login_prompter.cc
|
| +++ b/chrome/browser/ui/auto_login_prompter.cc
|
| @@ -101,6 +101,43 @@ void AutoLoginPrompter::ShowInfoBarIfPossible(net::URLRequest* request,
|
| }
|
|
|
| // static
|
| +bool AutoLoginPrompter::ParseAutoLoginHeader(const std::string& input,
|
| + Params* output) {
|
| + // TODO(pliard): Investigate/fix potential internationalization issue. It
|
| + // seems that "account" from the x-auto-login header might contain non-ASCII
|
| + // characters.
|
| + if (input.empty())
|
| + return false;
|
| +
|
| + std::vector<std::pair<std::string, std::string> > pairs;
|
| + if (!base::SplitStringIntoKeyValuePairs(input, '=', '&', &pairs))
|
| + return false;
|
| +
|
| + // Parse the information from the |input| string.
|
| + Params params;
|
| + for (size_t i = 0; i < pairs.size(); ++i) {
|
| + const std::pair<std::string, std::string>& pair = pairs[i];
|
| + std::string unescaped_value(net::UnescapeURLComponent(
|
| + pair.second, net::UnescapeRule::URL_SPECIAL_CHARS));
|
| + if (pair.first == "realm") {
|
| + // Currently we only accept GAIA credentials.
|
| + if (unescaped_value != "com.google")
|
| + return false;
|
| + params.realm = unescaped_value;
|
| + } else if (pair.first == "account") {
|
| + params.account = unescaped_value;
|
| + } else if (pair.first == "args") {
|
| + params.args = unescaped_value;
|
| + }
|
| + }
|
| + if (params.realm.empty() || params.args.empty())
|
| + return false;
|
| +
|
| + *output = params;
|
| + return true;
|
| +}
|
| +
|
| +// static
|
| void AutoLoginPrompter::ShowInfoBarUIThread(Params params,
|
| const GURL& url,
|
| int child_id,
|
| @@ -152,40 +189,3 @@ void AutoLoginPrompter::Observe(int type,
|
| // there's no reason to live further.
|
| delete this;
|
| }
|
| -
|
| -// static
|
| -bool AutoLoginPrompter::ParseAutoLoginHeader(const std::string& input,
|
| - Params* output) {
|
| - // TODO(pliard): Investigate/fix potential internationalization issue. It
|
| - // seems that "account" from the x-auto-login header might contain non-ASCII
|
| - // characters.
|
| - if (input.empty())
|
| - return false;
|
| -
|
| - std::vector<std::pair<std::string, std::string> > pairs;
|
| - if (!base::SplitStringIntoKeyValuePairs(input, '=', '&', &pairs))
|
| - return false;
|
| -
|
| - // Parse the information from the |input| string.
|
| - Params params;
|
| - for (size_t i = 0; i < pairs.size(); ++i) {
|
| - const std::pair<std::string, std::string>& pair = pairs[i];
|
| - std::string unescaped_value(net::UnescapeURLComponent(
|
| - pair.second, net::UnescapeRule::URL_SPECIAL_CHARS));
|
| - if (pair.first == "realm") {
|
| - // Currently we only accept GAIA credentials.
|
| - if (unescaped_value != "com.google")
|
| - return false;
|
| - params.realm = unescaped_value;
|
| - } else if (pair.first == "account") {
|
| - params.account = unescaped_value;
|
| - } else if (pair.first == "args") {
|
| - params.args = unescaped_value;
|
| - }
|
| - }
|
| - if (params.realm.empty() || params.args.empty())
|
| - return false;
|
| -
|
| - *output = params;
|
| - return true;
|
| -}
|
|
|