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

Unified Diff: components/dom_distiller/core/url_utils.cc

Issue 442503002: Retrieve article original URL from entryID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments Created 6 years, 4 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: components/dom_distiller/core/url_utils.cc
diff --git a/components/dom_distiller/core/url_utils.cc b/components/dom_distiller/core/url_utils.cc
index d5ca57d4e3554c8369397507601251c6ee91e6d1..9344f8b2a348f3adbe4521367a09f160a0d0bc6c 100644
--- a/components/dom_distiller/core/url_utils.cc
+++ b/components/dom_distiller/core/url_utils.cc
@@ -33,14 +33,22 @@ const GURL GetDistillerViewUrlFromUrl(const std::string& scheme,
return net::AppendOrReplaceQueryParameter(url, kUrlKey, view_url.spec());
}
+std::string GetValueForKeyInUrl(const GURL& url, const std::string& key) {
+ std::string value;
robliao 2014/08/13 23:43:15 Move declaration to after return "" (Minimal scope
sunangel 2014/08/13 23:47:15 Done.
+ if (!url.is_valid())
+ return "";
+ if (net::GetValueForKeyInQuery(url, key, &value)) {
+ return value;
+ }
+ return "";
+}
+
std::string GetValueForKeyInUrlPathQuery(const std::string& path,
const std::string& key) {
// Tools for retrieving a value in a query only works with full GURLs, so
// using a dummy scheme and host to create a fake URL which can be parsed.
GURL dummy_url(kDummyInternalUrlPrefix + path);
- std::string value;
- net::GetValueForKeyInQuery(dummy_url, key, &value);
- return value;
+ return GetValueForKeyInUrl(dummy_url, key);
}
bool IsUrlDistillable(const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698