Chromium Code Reviews| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return result; | 139 return result; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| 143 | 143 |
| 144 namespace chromeos { | 144 namespace chromeos { |
| 145 namespace system { | 145 namespace system { |
| 146 | 146 |
| 147 // Creates a list of pairs of each timezone's ID and name. | 147 // Creates a list of pairs of each timezone's ID and name. |
| 148 std::unique_ptr<base::ListValue> GetTimezoneList() { | 148 std::unique_ptr<base::ListValue> GetTimezoneList() { |
| 149 const std::vector<icu::TimeZone*> &timezones = | 149 auto& timezones = |
|
Daniel Erat
2016/09/30 22:38:04
can this remain const?
Avi (use Gerrit)
2016/10/01 21:51:05
Hmmm. Probably.
| |
| 150 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); | 150 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); |
| 151 std::unique_ptr<base::ListValue> timezoneList(new base::ListValue()); | 151 std::unique_ptr<base::ListValue> timezoneList(new base::ListValue()); |
| 152 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones.begin(); | 152 for (const auto& timezone : timezones) { |
| 153 iter != timezones.end(); ++iter) { | |
| 154 const icu::TimeZone* timezone = *iter; | |
| 155 base::ListValue* option = new base::ListValue(); | 153 base::ListValue* option = new base::ListValue(); |
| 156 option->Append(new base::StringValue( | 154 option->Append(new base::StringValue( |
| 157 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone))); | 155 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone.get()))); |
| 158 option->Append(new base::StringValue(GetTimezoneName(*timezone))); | 156 option->Append(new base::StringValue(GetTimezoneName(*timezone.get()))); |
| 159 timezoneList->Append(option); | 157 timezoneList->Append(option); |
| 160 } | 158 } |
| 161 return timezoneList; | 159 return timezoneList; |
| 162 } | 160 } |
| 163 | 161 |
| 164 bool HasSystemTimezonePolicy() { | 162 bool HasSystemTimezonePolicy() { |
| 165 policy::BrowserPolicyConnectorChromeOS* connector = | 163 policy::BrowserPolicyConnectorChromeOS* connector = |
| 166 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 164 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 167 if (!connector->IsEnterpriseManaged()) | 165 if (!connector->IsEnterpriseManaged()) |
| 168 return false; | 166 return false; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 189 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId | 187 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId |
| 190 << "'"; | 188 << "'"; |
| 191 | 189 |
| 192 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 190 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 193 base::UTF8ToUTF16(timezone->timeZoneId)); | 191 base::UTF8ToUTF16(timezone->timeZoneId)); |
| 194 } | 192 } |
| 195 } | 193 } |
| 196 | 194 |
| 197 } // namespace system | 195 } // namespace system |
| 198 } // namespace chromeos | 196 } // namespace chromeos |
| OLD | NEW |