1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_DOM_DISTILLER_CORE_URL_UTILS_H_
6#define COMPONENTS_DOM_DISTILLER_CORE_URL_UTILS_H_
7
8#include <string>
9
10class GURL;
11
12namespace dom_distiller {
13
14namespace url_utils {
15
16// Returns the URL for viewing distilled content for an entry.
17const GURL GetDistillerViewUrlFromEntryId(const std::string& scheme,
18                                          const std::string& entry_id);
19
20// Returns the URL for viewing distilled content for a URL.
21const GURL GetDistillerViewUrlFromUrl(const std::string& scheme,
22                                      const GURL& view_url);
23
24// Returns the value of the query parameter for the given |key| for a given URL.
25// If the URL is invalid or if the key is not found, returns an empty string.
26// If there are multiple keys found in the URL, returns the value for the first
27// key.
28std::string GetValueForKeyInUrl(const GURL& url, const std::string& key);
29
30// Returns the value of the query parameter for the given path.
31std::string GetValueForKeyInUrlPathQuery(const std::string& path,
32                                         const std::string& key);
33
34// Returns whether it should be possible to distill the given |url|.
35bool IsUrlDistillable(const GURL& url);
36
37// Returns whether the given |url| is for a distilled page.
38bool IsDistilledPage(const GURL& url);
39
40// Returns a JavaScript snippet that returns whether or not a page should be
41// used with DomDistillerService and can be executed in a live page.
42std::string GetIsDistillableJs();
43
44}  // namespace url_utils
45
46}  // namespace dom_distiller
47
48#endif  // COMPONENTS_DOM_DISTILLER_CORE_URL_UTILS_H_
49