Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: components/dom_distiller/core/url_utils.cc

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update AUTHORS file to reflect the correct HP name used in the CLA Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698