| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/settings/system_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/system_settings_provider.h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chromeos/login/login_state.h" | 10 #include "chromeos/login/login_state.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 timezone_value_.reset(new base::StringValue( | 22 timezone_value_.reset(new base::StringValue( |
| 23 timezone_settings->GetCurrentTimezoneID())); | 23 timezone_settings->GetCurrentTimezoneID())); |
| 24 } | 24 } |
| 25 | 25 |
| 26 SystemSettingsProvider::~SystemSettingsProvider() { | 26 SystemSettingsProvider::~SystemSettingsProvider() { |
| 27 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 27 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SystemSettingsProvider::DoSet(const std::string& path, | 30 void SystemSettingsProvider::DoSet(const std::string& path, |
| 31 const base::Value& in_value) { | 31 const base::Value& in_value) { |
| 32 // Non-guest users can change the time zone. | 32 // Only non-guest users can change the time zone. |
| 33 if (LoginState::Get()->IsGuestUser()) | 33 if (LoginState::Get()->IsGuestSessionUser() || |
| 34 LoginState::Get()->IsPublicSessionUser()) { |
| 34 return; | 35 return; |
| 36 } |
| 35 | 37 |
| 36 if (path == kSystemTimezone) { | 38 if (path == kSystemTimezone) { |
| 37 base::string16 timezone_id; | 39 base::string16 timezone_id; |
| 38 if (!in_value.GetAsString(&timezone_id)) | 40 if (!in_value.GetAsString(&timezone_id)) |
| 39 return; | 41 return; |
| 40 // This will call TimezoneChanged. | 42 // This will call TimezoneChanged. |
| 41 system::TimezoneSettings::GetInstance()->SetTimezoneFromID(timezone_id); | 43 system::TimezoneSettings::GetInstance()->SetTimezoneFromID(timezone_id); |
| 42 } | 44 } |
| 43 } | 45 } |
| 44 | 46 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 } | 61 } |
| 60 | 62 |
| 61 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) { | 63 void SystemSettingsProvider::TimezoneChanged(const icu::TimeZone& timezone) { |
| 62 // Fires system setting change notification. | 64 // Fires system setting change notification. |
| 63 timezone_value_.reset(new base::StringValue( | 65 timezone_value_.reset(new base::StringValue( |
| 64 system::TimezoneSettings::GetTimezoneID(timezone))); | 66 system::TimezoneSettings::GetTimezoneID(timezone))); |
| 65 NotifyObservers(kSystemTimezone); | 67 NotifyObservers(kSystemTimezone); |
| 66 } | 68 } |
| 67 | 69 |
| 68 } // namespace chromeos | 70 } // namespace chromeos |
| OLD | NEW |