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 <string> | 10 #include <string> |
| 11 #include <utility> |
10 | 12 |
11 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
12 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
13 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
16 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
17 #include "base/values.h" | 19 #include "base/values.h" |
18 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 namespace system { | 147 namespace system { |
146 | 148 |
147 // Creates a list of pairs of each timezone's ID and name. | 149 // Creates a list of pairs of each timezone's ID and name. |
148 std::unique_ptr<base::ListValue> GetTimezoneList() { | 150 std::unique_ptr<base::ListValue> GetTimezoneList() { |
149 const std::vector<icu::TimeZone*> &timezones = | 151 const std::vector<icu::TimeZone*> &timezones = |
150 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); | 152 chromeos::system::TimezoneSettings::GetInstance()->GetTimezoneList(); |
151 std::unique_ptr<base::ListValue> timezoneList(new base::ListValue()); | 153 std::unique_ptr<base::ListValue> timezoneList(new base::ListValue()); |
152 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones.begin(); | 154 for (std::vector<icu::TimeZone*>::const_iterator iter = timezones.begin(); |
153 iter != timezones.end(); ++iter) { | 155 iter != timezones.end(); ++iter) { |
154 const icu::TimeZone* timezone = *iter; | 156 const icu::TimeZone* timezone = *iter; |
155 base::ListValue* option = new base::ListValue(); | 157 std::unique_ptr<base::ListValue> option(new base::ListValue()); |
156 option->Append(new base::StringValue( | 158 option->AppendString( |
157 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone))); | 159 chromeos::system::TimezoneSettings::GetTimezoneID(*timezone)); |
158 option->Append(new base::StringValue(GetTimezoneName(*timezone))); | 160 option->AppendString(GetTimezoneName(*timezone)); |
159 timezoneList->Append(option); | 161 timezoneList->Append(std::move(option)); |
160 } | 162 } |
161 return timezoneList; | 163 return timezoneList; |
162 } | 164 } |
163 | 165 |
164 bool HasSystemTimezonePolicy() { | 166 bool HasSystemTimezonePolicy() { |
165 policy::BrowserPolicyConnectorChromeOS* connector = | 167 policy::BrowserPolicyConnectorChromeOS* connector = |
166 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 168 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
167 if (!connector->IsEnterpriseManaged()) | 169 if (!connector->IsEnterpriseManaged()) |
168 return false; | 170 return false; |
169 | 171 |
(...skipping 19 matching lines...) Expand all Loading... |
189 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId | 191 VLOG(1) << "Refresh TimeZone: setting timezone to '" << timezone->timeZoneId |
190 << "'"; | 192 << "'"; |
191 | 193 |
192 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 194 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
193 base::UTF8ToUTF16(timezone->timeZoneId)); | 195 base::UTF8ToUTF16(timezone->timeZoneId)); |
194 } | 196 } |
195 } | 197 } |
196 | 198 |
197 } // namespace system | 199 } // namespace system |
198 } // namespace chromeos | 200 } // namespace chromeos |
OLD | NEW |