OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/system/timezone_settings.h" | 5 #include "chrome/browser/chromeos/system/timezone_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/chromeos/chromeos_version.h" | 10 #include "base/chromeos/chromeos_version.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void SetTimezoneIDFromString(const std::string& id) { | 194 void SetTimezoneIDFromString(const std::string& id) { |
195 // Change the kTimezoneSymlink symlink to the path for this timezone. | 195 // Change the kTimezoneSymlink symlink to the path for this timezone. |
196 // We want to do this in an atomic way. So we are going to create the symlink | 196 // We want to do this in an atomic way. So we are going to create the symlink |
197 // at kTimezoneSymlink2 and then move it to kTimezoneSymlink | 197 // at kTimezoneSymlink2 and then move it to kTimezoneSymlink |
198 | 198 |
199 base::FilePath timezone_symlink(kTimezoneSymlink); | 199 base::FilePath timezone_symlink(kTimezoneSymlink); |
200 base::FilePath timezone_symlink2(kTimezoneSymlink2); | 200 base::FilePath timezone_symlink2(kTimezoneSymlink2); |
201 base::FilePath timezone_file(kTimezoneFilesDir + id); | 201 base::FilePath timezone_file(kTimezoneFilesDir + id); |
202 | 202 |
203 // Make sure timezone_file exists. | 203 // Make sure timezone_file exists. |
204 if (!file_util::PathExists(timezone_file)) { | 204 if (!base::PathExists(timezone_file)) { |
205 LOG(ERROR) << "SetTimezoneID: Cannot find timezone file " | 205 LOG(ERROR) << "SetTimezoneID: Cannot find timezone file " |
206 << timezone_file.value(); | 206 << timezone_file.value(); |
207 return; | 207 return; |
208 } | 208 } |
209 | 209 |
210 // Delete old symlink2 if it exists. | 210 // Delete old symlink2 if it exists. |
211 base::Delete(timezone_symlink2, false); | 211 base::Delete(timezone_symlink2, false); |
212 | 212 |
213 // Create new symlink2. | 213 // Create new symlink2. |
214 if (symlink(timezone_file.value().c_str(), | 214 if (symlink(timezone_file.value().c_str(), |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 // static | 451 // static |
452 string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { | 452 string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { |
453 icu::UnicodeString id; | 453 icu::UnicodeString id; |
454 timezone.getID(id); | 454 timezone.getID(id); |
455 return string16(id.getBuffer(), id.length()); | 455 return string16(id.getBuffer(), id.length()); |
456 } | 456 } |
457 | 457 |
458 } // namespace system | 458 } // namespace system |
459 } // namespace chromeos | 459 } // namespace chromeos |
OLD | NEW |