| 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) {
|
|
|