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

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

Issue 8727037: Signed settings refactoring: Proper caching and more tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Fixed small bugs. Rebased to ToT. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/system_settings_provider.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc b/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
index 1d629565bcd9c363e1abaae63136d8c45603fad3..815dc49418cedaf585e0706fee2ab4f4a60812b4 100644
--- a/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
+++ b/chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
@@ -189,7 +189,8 @@ SystemSettingsProvider::SystemSettingsProvider() {
icu::UnicodeString(kTimeZones[i], -1, US_INV)));
}
system::TimezoneSettings::GetInstance()->AddObserver(this);
-
+ timezone_value_.reset(base::Value::CreateStringValue(GetKnownTimezoneID(
+ system::TimezoneSettings::GetInstance()->GetTimezone())));
}
SystemSettingsProvider::~SystemSettingsProvider() {
@@ -211,22 +212,20 @@ void SystemSettingsProvider::DoSet(const std::string& path,
if (!timezone)
return;
system::TimezoneSettings::GetInstance()->SetTimezone(*timezone);
+ timezone_value_.reset(
+ base::Value::CreateStringValue(GetKnownTimezoneID(*timezone)));
}
}
const base::Value* SystemSettingsProvider::Get(const std::string& path) const {
- if (path == kSystemTimezone) {
- // TODO(pastarmovj): Cache this in the local_state instead of locally.
- system_timezone_.reset(base::Value::CreateStringValue(GetKnownTimezoneID(
- system::TimezoneSettings::GetInstance()->GetTimezone())));
- return system_timezone_.get();
- }
+ if (path == kSystemTimezone)
+ return timezone_value_.get();
return NULL;
}
// The timezone is always trusted.
bool SystemSettingsProvider::GetTrusted(const std::string& path,
- const base::Closure& callback) const {
+ const base::Closure& callback) {
return true;
}
@@ -234,8 +233,15 @@ bool SystemSettingsProvider::HandlesSetting(const std::string& path) const {
return path == kSystemTimezone;
}
+void SystemSettingsProvider::Reload() {
+ // TODO(pastarmovj): We can actually cache the timezone here to make returning
+ // it faster.
+}
+
void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) {
// Fires system setting change notification.
+ timezone_value_.reset(
+ base::Value::CreateStringValue(GetKnownTimezoneID(timezone)));
CrosSettings::Get()->FireObservers(kSystemTimezone);
}
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/system_settings_provider.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698