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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan 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 30 matching lines...) Expand all
41 command_line->GetSwitchValueASCII(switches::kCloudPrintURL)); 41 command_line->GetSwitchValueASCII(switches::kCloudPrintURL));
42 if (cloud_print_url.is_empty()) 42 if (cloud_print_url.is_empty())
43 cloud_print_url = GURL(kCloudPrintURL); 43 cloud_print_url = GURL(kCloudPrintURL);
44 return cloud_print_url; 44 return cloud_print_url;
45 } 45 }
46 46
47 GURL GetCloudPrintRelativeURL(const std::string& relative_path) { 47 GURL GetCloudPrintRelativeURL(const std::string& relative_path) {
48 GURL url = GetCloudPrintURL(); 48 GURL url = GetCloudPrintURL();
49 std::string path; 49 std::string path;
50 static const char kURLPathSeparator[] = "/"; 50 static const char kURLPathSeparator[] = "/";
51 base::TrimString(url.path(), kURLPathSeparator, &path); 51 base::TrimString(url.path().as_string(), kURLPathSeparator, &path);
52 std::string trimmed_path; 52 std::string trimmed_path;
53 base::TrimString(relative_path, kURLPathSeparator, &trimmed_path); 53 base::TrimString(relative_path, kURLPathSeparator, &trimmed_path);
54 path += kURLPathSeparator; 54 path += kURLPathSeparator;
55 path += trimmed_path; 55 path += trimmed_path;
56 GURL::Replacements replacements; 56 GURL::Replacements replacements;
57 replacements.SetPathStr(path); 57 replacements.SetPathStr(path);
58 return url.ReplaceComponents(replacements); 58 return url.ReplaceComponents(replacements);
59 } 59 }
60 60
61 GURL GetCloudPrintSigninURL() { 61 GURL GetCloudPrintSigninURL() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/arc/intent_helper/intent_filter.cc ('k') | components/content_settings/core/common/content_settings_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698