OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/chromeos/system_settings_provider.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 system::TimezoneSettings::GetInstance()->AddObserver(this); | 188 system::TimezoneSettings::GetInstance()->AddObserver(this); |
189 | 189 |
190 } | 190 } |
191 | 191 |
192 SystemSettingsProvider::~SystemSettingsProvider() { | 192 SystemSettingsProvider::~SystemSettingsProvider() { |
193 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 193 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
194 STLDeleteElements(&timezones_); | 194 STLDeleteElements(&timezones_); |
195 } | 195 } |
196 | 196 |
197 void SystemSettingsProvider::DoSet(const std::string& path, Value* in_value) { | 197 void SystemSettingsProvider::DoSet(const std::string& path, |
| 198 const base::Value& in_value) { |
198 // Non-guest users can change the time zone. | 199 // Non-guest users can change the time zone. |
199 if (UserManager::Get()->IsLoggedInAsGuest()) | 200 if (UserManager::Get()->IsLoggedInAsGuest()) |
200 return; | 201 return; |
201 | 202 |
202 if (path == kSystemTimezone) { | 203 if (path == kSystemTimezone) { |
203 string16 value; | 204 string16 value; |
204 if (!in_value || !in_value->IsType(Value::TYPE_STRING) || | 205 if (!in_value.IsType(Value::TYPE_STRING) || !in_value.GetAsString(&value)) |
205 !in_value->GetAsString(&value)) | |
206 return; | 206 return; |
207 const icu::TimeZone* timezone = GetTimezone(value); | 207 const icu::TimeZone* timezone = GetTimezone(value); |
208 if (!timezone) | 208 if (!timezone) |
209 return; | 209 return; |
210 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); | 210 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 const base::Value* SystemSettingsProvider::Get(const std::string& path) const { | 214 const base::Value* SystemSettingsProvider::Get(const std::string& path) const { |
215 if (path == kSystemTimezone) { | 215 if (path == kSystemTimezone) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 const icu::TimeZone* known_timezone = *iter; | 313 const icu::TimeZone* known_timezone = *iter; |
314 if (known_timezone->hasSameRules(timezone)) | 314 if (known_timezone->hasSameRules(timezone)) |
315 return GetTimezoneID(*known_timezone); | 315 return GetTimezoneID(*known_timezone); |
316 } | 316 } |
317 | 317 |
318 // Not able to find a matching timezone in our list. | 318 // Not able to find a matching timezone in our list. |
319 return string16(); | 319 return string16(); |
320 } | 320 } |
321 | 321 |
322 } // namespace chromeos | 322 } // namespace chromeos |
OLD | NEW |