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 #include "components/dom_distiller/core/url_utils.h" | 5 #include "components/dom_distiller/core/url_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "components/dom_distiller/core/url_constants.h" | 10 #include "components/dom_distiller/core/url_constants.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 GURL url(scheme + "://" + base::GenerateGUID()); | 28 GURL url(scheme + "://" + base::GenerateGUID()); |
29 return net::AppendOrReplaceQueryParameter(url, kEntryIdKey, entry_id); | 29 return net::AppendOrReplaceQueryParameter(url, kEntryIdKey, entry_id); |
30 } | 30 } |
31 | 31 |
32 const GURL GetDistillerViewUrlFromUrl(const std::string& scheme, | 32 const GURL GetDistillerViewUrlFromUrl(const std::string& scheme, |
33 const GURL& view_url) { | 33 const GURL& view_url) { |
34 GURL url(scheme + "://" + base::GenerateGUID()); | 34 GURL url(scheme + "://" + base::GenerateGUID()); |
35 return net::AppendOrReplaceQueryParameter(url, kUrlKey, view_url.spec()); | 35 return net::AppendOrReplaceQueryParameter(url, kUrlKey, view_url.spec()); |
36 } | 36 } |
37 | 37 |
| 38 const GURL GetPrintPreviewDistillerViewUrlFromUrl(const std::string& scheme, |
| 39 const GURL& view_url) { |
| 40 GURL url(scheme + "://" + base::GenerateGUID() + "/printing/"); |
| 41 return net::AppendOrReplaceQueryParameter(url, kUrlKey, view_url.spec()); |
| 42 } |
| 43 |
38 const GURL GetOriginalUrlFromDistillerUrl(const GURL& url) { | 44 const GURL GetOriginalUrlFromDistillerUrl(const GURL& url) { |
39 if (!dom_distiller::url_utils::IsDistilledPage(url)) | 45 if (!dom_distiller::url_utils::IsDistilledPage(url)) |
40 return url; | 46 return url; |
41 | 47 |
42 std::string original_url_str; | 48 std::string original_url_str; |
43 net::GetValueForKeyInQuery(url, kUrlKey, &original_url_str); | 49 net::GetValueForKeyInQuery(url, kUrlKey, &original_url_str); |
44 | 50 |
45 return GURL(original_url_str); | 51 return GURL(original_url_str); |
46 } | 52 } |
47 | 53 |
(...skipping 24 matching lines...) Expand all Loading... |
72 } | 78 } |
73 | 79 |
74 std::string GetIsDistillableJs() { | 80 std::string GetIsDistillableJs() { |
75 return ResourceBundle::GetSharedInstance() | 81 return ResourceBundle::GetSharedInstance() |
76 .GetRawDataResource(IDR_IS_DISTILLABLE_JS).as_string(); | 82 .GetRawDataResource(IDR_IS_DISTILLABLE_JS).as_string(); |
77 } | 83 } |
78 | 84 |
79 } // namespace url_utils | 85 } // namespace url_utils |
80 | 86 |
81 } // namespace dom_distiller | 87 } // namespace dom_distiller |
OLD | NEW |