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

Side by Side Diff: chromeos/settings/timezone_settings.cc

Issue 2137503002: Revert of Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 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 "chromeos/settings/timezone_settings.h" 5 #include "chromeos/settings/timezone_settings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const ssize_t len = readlink(kTimezoneSymlink, buf, 216 const ssize_t len = readlink(kTimezoneSymlink, buf,
217 sizeof(buf)-1); 217 sizeof(buf)-1);
218 if (len == -1) { 218 if (len == -1) {
219 LOG(ERROR) << "GetTimezoneID: Cannot read timezone symlink " 219 LOG(ERROR) << "GetTimezoneID: Cannot read timezone symlink "
220 << kTimezoneSymlink; 220 << kTimezoneSymlink;
221 return std::string(); 221 return std::string();
222 } 222 }
223 223
224 std::string timezone(buf, len); 224 std::string timezone(buf, len);
225 // Remove kTimezoneFilesDir from the beginning. 225 // Remove kTimezoneFilesDir from the beginning.
226 if (!base::StartsWith(timezone, kTimezoneFilesDir, 226 if (timezone.find(kTimezoneFilesDir) != 0) {
227 base::CompareCase::SENSITIVE)) {
228 LOG(ERROR) << "GetTimezoneID: Timezone symlink is wrong " 227 LOG(ERROR) << "GetTimezoneID: Timezone symlink is wrong "
229 << timezone; 228 << timezone;
230 return std::string(); 229 return std::string();
231 } 230 }
232 231
233 return timezone.substr(strlen(kTimezoneFilesDir)); 232 return timezone.substr(strlen(kTimezoneFilesDir));
234 } 233 }
235 234
236 void SetTimezoneIDFromString(const std::string& id) { 235 void SetTimezoneIDFromString(const std::string& id) {
237 // Change the kTimezoneSymlink symlink to the path for this timezone. 236 // Change the kTimezoneSymlink symlink to the path for this timezone.
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 474
476 // static 475 // static
477 base::string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { 476 base::string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) {
478 icu::UnicodeString id; 477 icu::UnicodeString id;
479 timezone.getID(id); 478 timezone.getID(id);
480 return base::string16(id.getBuffer(), id.length()); 479 return base::string16(id.getBuffer(), id.length());
481 } 480 }
482 481
483 } // namespace system 482 } // namespace system
484 } // namespace chromeos 483 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/session_commands.cc ('k') | components/devtools_http_handler/devtools_http_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698