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