| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (!base::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::DeleteFile(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(), |
| 215 timezone_symlink2.value().c_str()) == -1) { | 215 timezone_symlink2.value().c_str()) == -1) { |
| 216 LOG(ERROR) << "SetTimezoneID: Unable to create symlink " | 216 LOG(ERROR) << "SetTimezoneID: Unable to create symlink " |
| 217 << timezone_symlink2.value() << " to " << timezone_file.value(); | 217 << timezone_symlink2.value() << " to " << timezone_file.value(); |
| 218 return; | 218 return; |
| 219 } | 219 } |
| 220 | 220 |
| 221 // Move symlink2 to symlink. | 221 // Move symlink2 to symlink. |
| (...skipping 228 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 |