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/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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 url = net::AppendQueryParameter(url, "sarp", "1"); | 78 url = net::AppendQueryParameter(url, "sarp", "1"); |
79 std::string continue_str = GetCloudPrintURL().spec(); | 79 std::string continue_str = GetCloudPrintURL().spec(); |
80 url = net::AppendQueryParameter(url, "continue", continue_str); | 80 url = net::AppendQueryParameter(url, "continue", continue_str); |
81 return url; | 81 return url; |
82 } | 82 } |
83 | 83 |
84 bool IsCloudPrintURL(const GURL& url) { | 84 bool IsCloudPrintURL(const GURL& url) { |
85 GURL cloud_print_url = GetCloudPrintURL(); | 85 GURL cloud_print_url = GetCloudPrintURL(); |
86 return url.host() == cloud_print_url.host() && | 86 return url.host() == cloud_print_url.host() && |
87 url.scheme() == cloud_print_url.scheme() && | 87 url.scheme() == cloud_print_url.scheme() && |
88 base::StartsWithASCII(url.path(), cloud_print_url.path(), true); | 88 base::StartsWith(url.path(), cloud_print_url.path(), |
| 89 base::CompareCase::SENSITIVE); |
89 } | 90 } |
90 | 91 |
91 GURL GetCloudPrintEnableURL(const std::string& proxy_id) { | 92 GURL GetCloudPrintEnableURL(const std::string& proxy_id) { |
92 GURL url = GetCloudPrintRelativeURL("enable_chrome_connector/enable.html"); | 93 GURL url = GetCloudPrintRelativeURL("enable_chrome_connector/enable.html"); |
93 url = net::AppendQueryParameter(url, "proxy", proxy_id); | 94 url = net::AppendQueryParameter(url, "proxy", proxy_id); |
94 return url; | 95 return url; |
95 } | 96 } |
96 | 97 |
97 GURL GetCloudPrintEnableWithSigninURL(const std::string& proxy_id) { | 98 GURL GetCloudPrintEnableWithSigninURL(const std::string& proxy_id) { |
98 GURL url(GaiaUrls::GetInstance()->service_login_url()); | 99 GURL url(GaiaUrls::GetInstance()->service_login_url()); |
(...skipping 28 matching lines...) Expand all Loading... |
127 std::string trimmed_path; | 128 std::string trimmed_path; |
128 base::TrimString(relative_path, kURLPathSeparator, &trimmed_path); | 129 base::TrimString(relative_path, kURLPathSeparator, &trimmed_path); |
129 path += kURLPathSeparator; | 130 path += kURLPathSeparator; |
130 path += trimmed_path; | 131 path += trimmed_path; |
131 GURL::Replacements replacements; | 132 GURL::Replacements replacements; |
132 replacements.SetPathStr(path); | 133 replacements.SetPathStr(path); |
133 return url.ReplaceComponents(replacements); | 134 return url.ReplaceComponents(replacements); |
134 } | 135 } |
135 | 136 |
136 } // namespace cloud_devices | 137 } // namespace cloud_devices |
OLD | NEW |