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

Unified Diff: chrome/browser/ui/auto_login_prompter.cc

Issue 10800074: Making AutoLoginPrompter::ParseAutoLoginHeader public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changing method implementation order. Created 8 years, 5 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
« no previous file with comments | « chrome/browser/ui/auto_login_prompter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
-}
« no previous file with comments | « chrome/browser/ui/auto_login_prompter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698