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

Unified Diff: chrome/browser/net/browser_url_util.cc

Issue 9271025: Update Gaia URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits, fix unit_tests failure and update license headers Created 8 years, 11 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/net/browser_url_util.h ('k') | chrome/browser/net/browser_url_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/browser_url_util.cc
diff --git a/chrome/browser/net/browser_url_util.cc b/chrome/browser/net/browser_url_util.cc
index 4c33181b135497e73be760a63cf139a2b75c53cb..b3e967d7611352b0f2f560511075908f5593d393 100644
--- a/chrome/browser/net/browser_url_util.cc
+++ b/chrome/browser/net/browser_url_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -8,6 +8,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
+#include "googleurl/src/url_util.h"
#include "net/base/escape.h"
#include "net/base/net_util.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
@@ -44,4 +45,28 @@ GURL AppendQueryParameter(const GURL& url,
return url.ReplaceComponents(replacements);
}
+bool GetValueForKeyInQuery(const GURL& url,
+ const std::string& search_key,
+ std::string* out_value) {
+ url_parse::Component query = url.parsed_for_possibly_invalid_spec().query;
+ url_parse::Component key, value;
+ while (url_parse::ExtractQueryKeyValue(
+ url.spec().c_str(), &query, &key, &value)) {
+ if (key.is_nonempty()) {
+ std::string key_string = url.spec().substr(key.begin, key.len);
+ if (key_string == search_key) {
+ if (value.is_nonempty()) {
+ *out_value = net::UnescapeURLComponent(
+ url.spec().substr(value.begin, value.len),
+ net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS);
+ } else {
+ *out_value = "";
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
} // namespace chrome_browser_net
« no previous file with comments | « chrome/browser/net/browser_url_util.h ('k') | chrome/browser/net/browser_url_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698