Chromium Code Reviews| 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) { |