Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc

Issue 8091002: PART2: Make SignedSettings use proper Value types instead of string all around the place. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the nits and rebased on ToT (which now has PART1 in). Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/system_settings_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 system::TimezoneSettings::GetInstance()->AddObserver(this); 191 system::TimezoneSettings::GetInstance()->AddObserver(this);
192 192
193 } 193 }
194 194
195 SystemSettingsProvider::~SystemSettingsProvider() { 195 SystemSettingsProvider::~SystemSettingsProvider() {
196 system::TimezoneSettings::GetInstance()->RemoveObserver(this); 196 system::TimezoneSettings::GetInstance()->RemoveObserver(this);
197 STLDeleteElements(&timezones_); 197 STLDeleteElements(&timezones_);
198 } 198 }
199 199
200 void SystemSettingsProvider::DoSet(const std::string& path, Value* in_value) { 200 void SystemSettingsProvider::DoSet(const std::string& path,
201 const base::Value& in_value) {
201 // Non-guest users can change the time zone. 202 // Non-guest users can change the time zone.
202 if (UserManager::Get()->IsLoggedInAsGuest()) 203 if (UserManager::Get()->IsLoggedInAsGuest())
203 return; 204 return;
204 205
205 if (path == kSystemTimezone) { 206 if (path == kSystemTimezone) {
206 string16 value; 207 string16 value;
207 if (!in_value || !in_value->IsType(Value::TYPE_STRING) || 208 if (!in_value.IsType(Value::TYPE_STRING) || !in_value.GetAsString(&value))
208 !in_value->GetAsString(&value))
209 return; 209 return;
210 const icu::TimeZone* timezone = GetTimezone(value); 210 const icu::TimeZone* timezone = GetTimezone(value);
211 if (!timezone) 211 if (!timezone)
212 return; 212 return;
213 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone); 213 system::TimezoneSettings::GetInstance()->SetTimezone(*timezone);
214 } 214 }
215 } 215 }
216 216
217 const base::Value* SystemSettingsProvider::Get(const std::string& path) const { 217 const base::Value* SystemSettingsProvider::Get(const std::string& path) const {
218 if (path == kSystemTimezone) { 218 if (path == kSystemTimezone) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 const icu::TimeZone* known_timezone = *iter; 316 const icu::TimeZone* known_timezone = *iter;
317 if (known_timezone->hasSameRules(timezone)) 317 if (known_timezone->hasSameRules(timezone))
318 return GetTimezoneID(*known_timezone); 318 return GetTimezoneID(*known_timezone);
319 } 319 }
320 320
321 // Not able to find a matching timezone in our list. 321 // Not able to find a matching timezone in our list.
322 return string16(); 322 return string16();
323 } 323 }
324 324
325 } // namespace chromeos 325 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/system_settings_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698