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

Side by Side Diff: components/cloud_devices/common/cloud_devices_urls.cc

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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/cloud_devices/common/cloud_devices_urls.h" 5 #include "components/cloud_devices/common/cloud_devices_urls.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "components/cloud_devices/common/cloud_devices_switches.h" 10 #include "components/cloud_devices/common/cloud_devices_switches.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 GURL GetCloudPrintAddAccountURL() { 70 GURL GetCloudPrintAddAccountURL() {
71 GURL url(GaiaUrls::GetInstance()->add_account_url()); 71 GURL url(GaiaUrls::GetInstance()->add_account_url());
72 url = net::AppendQueryParameter(url, "service", "cloudprint"); 72 url = net::AppendQueryParameter(url, "service", "cloudprint");
73 url = net::AppendQueryParameter(url, "sarp", "1"); 73 url = net::AppendQueryParameter(url, "sarp", "1");
74 std::string continue_str = GetCloudPrintURL().spec(); 74 std::string continue_str = GetCloudPrintURL().spec();
75 url = net::AppendQueryParameter(url, "continue", continue_str); 75 url = net::AppendQueryParameter(url, "continue", continue_str);
76 return url; 76 return url;
77 } 77 }
78 78
79 bool IsCloudPrintURL(const GURL& url) { 79 bool IsCloudPrintURL(const GURL& url) {
80 GURL cloud_print_url = GetCloudPrintURL(); 80 const GURL& cloud_print_url = GetCloudPrintURL();
81 return url.host() == cloud_print_url.host() && 81 return url.host_piece() == cloud_print_url.host_piece() &&
82 url.scheme() == cloud_print_url.scheme() && 82 url.scheme_piece() == cloud_print_url.scheme_piece() &&
83 base::StartsWith(url.path(), cloud_print_url.path(), 83 base::StartsWith(url.path(), cloud_print_url.path(),
84 base::CompareCase::SENSITIVE); 84 base::CompareCase::SENSITIVE);
85 } 85 }
86 86
87 GURL GetCloudPrintEnableURL(const std::string& proxy_id) { 87 GURL GetCloudPrintEnableURL(const std::string& proxy_id) {
88 GURL url = GetCloudPrintRelativeURL("enable_chrome_connector/enable.html"); 88 GURL url = GetCloudPrintRelativeURL("enable_chrome_connector/enable.html");
89 url = net::AppendQueryParameter(url, "proxy", proxy_id); 89 url = net::AppendQueryParameter(url, "proxy", proxy_id);
90 return url; 90 return url;
91 } 91 }
92 92
93 GURL GetCloudPrintEnableWithSigninURL(const std::string& proxy_id) { 93 GURL GetCloudPrintEnableWithSigninURL(const std::string& proxy_id) {
94 GURL url(GaiaUrls::GetInstance()->service_login_url()); 94 GURL url(GaiaUrls::GetInstance()->service_login_url());
95 url = net::AppendQueryParameter(url, "service", "cloudprint"); 95 url = net::AppendQueryParameter(url, "service", "cloudprint");
96 url = net::AppendQueryParameter(url, "sarp", "1"); 96 url = net::AppendQueryParameter(url, "sarp", "1");
97 std::string continue_str = GetCloudPrintEnableURL(proxy_id).spec(); 97 std::string continue_str = GetCloudPrintEnableURL(proxy_id).spec();
98 return net::AppendQueryParameter(url, "continue", continue_str); 98 return net::AppendQueryParameter(url, "continue", continue_str);
99 } 99 }
100 100
101 GURL GetCloudPrintManageDeviceURL(const std::string& device_id) { 101 GURL GetCloudPrintManageDeviceURL(const std::string& device_id) {
102 std::string ref = "printers/" + device_id; 102 std::string ref = "printers/" + device_id;
103 GURL::Replacements replacements; 103 GURL::Replacements replacements;
104 replacements.SetRefStr(ref); 104 replacements.SetRefStr(ref);
105 return GetCloudPrintURL().ReplaceComponents(replacements); 105 return GetCloudPrintURL().ReplaceComponents(replacements);
106 } 106 }
107 107
108 } // namespace cloud_devices 108 } // namespace cloud_devices
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_structure.cc ('k') | components/history/core/browser/history_match.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698