| 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/chromeos/system/timezone_util.h" | 5 #include "chrome/browser/chromeos/system/timezone_util.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return result; | 142 return result; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace | 145 } // namespace |
| 146 | 146 |
| 147 namespace chromeos { | 147 namespace chromeos { |
| 148 namespace system { | 148 namespace system { |
| 149 | 149 |
| 150 // Creates a list of pairs of each timezone's ID and name. | 150 // Creates a list of pairs of each timezone's ID and name. |
| 151 std::unique_ptr<base::ListValue> GetTimezoneList() { | 151 std::unique_ptr<base::ListValue> GetTimezoneList() { |
| 152 const std::vector<icu::TimeZone*> &timezones = | 152 const auto& timezones = |
| 153 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); | 153 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); |
| 154 std::unique_ptr<base::ListValue> timezoneList(new base::ListValue()); | 154 std::unique_ptr<base::ListValue> timezoneList(new base::ListValue()); |
| 155 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones.begin(); | 155 for (const auto& timezone : timezones) { |
| 156 iter != timezones.end(); ++iter) { | |
| 157 const icu::TimeZone* timezone = *iter; | |
| 158 auto option = base::MakeUnique<base::ListValue>(); | 156 auto option = base::MakeUnique<base::ListValue>(); |
| 159 option->AppendString( | 157 option->AppendString( |
| 160 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone)); | 158 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone)); |
| 161 option->AppendString(GetTimezoneName(*timezone)); | 159 option->AppendString(GetTimezoneName(*timezone)); |
| 162 timezoneList->Append(std::move(option)); | 160 timezoneList->Append(std::move(option)); |
| 163 } | 161 } |
| 164 return timezoneList; | 162 return timezoneList; |
| 165 } | 163 } |
| 166 | 164 |
| 167 bool HasSystemTimezonePolicy() { | 165 bool HasSystemTimezonePolicy() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 192 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId | 190 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId |
| 193 << "'"; | 191 << "'"; |
| 194 | 192 |
| 195 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 193 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 196 base::UTF8ToUTF16(timezone->timeZoneId)); | 194 base::UTF8ToUTF16(timezone->timeZoneId)); |
| 197 } | 195 } |
| 198 } | 196 } |
| 199 | 197 |
| 200 } // namespace system | 198 } // namespace system |
| 201 } // namespace chromeos | 199 } // namespace chromeos |
| OLD | NEW |