| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (error == -1) | 141 if (error == -1) |
| 142 return SYNC_STATUS_NETWORK_ERROR; | 142 return SYNC_STATUS_NETWORK_ERROR; |
| 143 | 143 |
| 144 util::Log(logging::LOG_WARNING, | 144 util::Log(logging::LOG_WARNING, |
| 145 FROM_HERE, | 145 FROM_HERE, |
| 146 "Got unexpected error: %d", | 146 "Got unexpected error: %d", |
| 147 static_cast<int>(error)); | 147 static_cast<int>(error)); |
| 148 return SYNC_STATUS_FAILED; | 148 return SYNC_STATUS_FAILED; |
| 149 } | 149 } |
| 150 | 150 |
| 151 std::string RemovePrefix(const std::string& str, const std::string& prefix) { | 151 bool RemovePrefix(const std::string& str, const std::string& prefix, |
| 152 if (StartsWithASCII(str, prefix, true)) | 152 std::string* out) { |
| 153 return std::string(str.begin() + prefix.size(), str.end()); | 153 if (!StartsWithASCII(str, prefix, true)) { |
| 154 return str; | 154 if (out) |
| 155 *out = str; |
| 156 return false; |
| 157 } |
| 158 |
| 159 if (out) |
| 160 *out = str.substr(prefix.size()); |
| 161 return true; |
| 155 } | 162 } |
| 156 | 163 |
| 157 } // namespace drive_backend | 164 } // namespace drive_backend |
| 158 } // namespace sync_file_system | 165 } // namespace sync_file_system |
| OLD | NEW |