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

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

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT (solved merging conflict). Created 9 years, 1 month 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
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/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (!in_value || !in_value->IsType(Value::TYPE_STRING) || 204 if (!in_value || !in_value->IsType(Value::TYPE_STRING) ||
205 !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 bool SystemSettingsProvider::Get(const std::string& path, 214 const base::Value* SystemSettingsProvider::Get(const std::string& path) const {
215 Value** out_value) const {
216 if (path == kSystemTimezone) { 215 if (path == kSystemTimezone) {
217 *out_value = Value::CreateStringValue(GetKnownTimezoneID( 216 // TODO(pastarmovj): Cache this in the local_state instead of locally.
218 system::TimezoneSettings::GetInstance()->GetTimezone())); 217 system_timezone_.reset(base::Value::CreateStringValue(GetKnownTimezoneID(
219 return true; 218 system::TimezoneSettings::GetInstance()->GetTimezone())));
219 return system_timezone_.get();
220 } 220 }
221 return false; 221 return NULL;
222 }
223
224 // The timezone is always trusted.
225 bool SystemSettingsProvider::GetTrusted(const std::string& path,
226 const base::Closure& callback) const {
227 return true;
222 } 228 }
223 229
224 bool SystemSettingsProvider::HandlesSetting(const std::string& path) const { 230 bool SystemSettingsProvider::HandlesSetting(const std::string& path) const {
225 return path == kSystemTimezone; 231 return path == kSystemTimezone;
226 } 232 }
227 233
228 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) { 234 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) {
229 // Fires system setting change notification. 235 // Fires system setting change notification.
230 CrosSettings::Get()->FireObservers(kSystemTimezone); 236 CrosSettings::Get()->FireObservers(kSystemTimezone);
231 } 237 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const icu::TimeZone* known_timezone = *iter; 313 const icu::TimeZone* known_timezone = *iter;
308 if (known_timezone->hasSameRules(timezone)) 314 if (known_timezone->hasSameRules(timezone))
309 return GetTimezoneID(*known_timezone); 315 return GetTimezoneID(*known_timezone);
310 } 316 }
311 317
312 // Not able to find a matching timezone in our list. 318 // Not able to find a matching timezone in our list.
313 return string16(); 319 return string16();
314 } 320 }
315 321
316 } // namespace chromeos 322 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698