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

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: string reference 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
« no previous file with comments | « components/dom_distiller/core/url_utils.h ('k') | components/dom_distiller/core/url_utils_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5596b20efa9ea00d422700ec19cc2696c7b92bc9..1a7545b7c059efca946ba113fc58ec25bd3fbbbc 100644
--- a/components/dom_distiller/core/url_utils.cc
+++ b/components/dom_distiller/core/url_utils.cc
@@ -35,14 +35,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) {
+ if (!url.is_valid())
+ return "";
+ std::string value;
+ 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) {
« no previous file with comments | « components/dom_distiller/core/url_utils.h ('k') | components/dom_distiller/core/url_utils_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698