| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 8 #include "chrome/browser/chromeos/cros/synaptics_library.h" | 9 #include "chrome/browser/chromeos/cros/synaptics_library.h" |
| 9 #include "chrome/browser/pref_member.h" | 10 #include "chrome/browser/pref_member.h" |
| 10 #include "chrome/browser/pref_service.h" | 11 #include "chrome/browser/pref_service.h" |
| 11 #include "chrome/common/notification_service.h" | 12 #include "chrome/common/notification_service.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "unicode/timezone.h" | 14 #include "unicode/timezone.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 // static | 18 // static |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 const NotificationSource& source, | 39 const NotificationSource& source, |
| 39 const NotificationDetails& details) { | 40 const NotificationDetails& details) { |
| 40 if (type == NotificationType::PREF_CHANGED) | 41 if (type == NotificationType::PREF_CHANGED) |
| 41 NotifyPrefChanged(Details<std::wstring>(details).ptr()); | 42 NotifyPrefChanged(Details<std::wstring>(details).ptr()); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void Preferences::NotifyPrefChanged(const std::wstring* pref_name) { | 45 void Preferences::NotifyPrefChanged(const std::wstring* pref_name) { |
| 45 if (!pref_name || *pref_name == prefs::kTimeZone) | 46 if (!pref_name || *pref_name == prefs::kTimeZone) |
| 46 SetTimeZone(timezone_.GetValue()); | 47 SetTimeZone(timezone_.GetValue()); |
| 47 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) | 48 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) |
| 48 SynapticsLibrary::Get()->SetBoolParameter(PARAM_BOOL_TAP_TO_CLICK, | 49 CrosLibrary::Get()->GetSynapticsLibrary()->SetBoolParameter( |
| 50 PARAM_BOOL_TAP_TO_CLICK, |
| 49 tap_to_click_enabled_.GetValue()); | 51 tap_to_click_enabled_.GetValue()); |
| 50 if (!pref_name || *pref_name == prefs::kVertEdgeScrollEnabled) | 52 if (!pref_name || *pref_name == prefs::kVertEdgeScrollEnabled) |
| 51 SynapticsLibrary::Get()->SetBoolParameter( | 53 CrosLibrary::Get()->GetSynapticsLibrary()->SetBoolParameter( |
| 52 PARAM_BOOL_VERTICAL_EDGE_SCROLLING, | 54 PARAM_BOOL_VERTICAL_EDGE_SCROLLING, |
| 53 vert_edge_scroll_enabled_.GetValue()); | 55 vert_edge_scroll_enabled_.GetValue()); |
| 54 if (!pref_name || *pref_name == prefs::kTouchpadSpeedFactor) | 56 if (!pref_name || *pref_name == prefs::kTouchpadSpeedFactor) |
| 55 SynapticsLibrary::Get()->SetRangeParameter(PARAM_RANGE_SPEED_SENSITIVITY, | 57 CrosLibrary::Get()->GetSynapticsLibrary()->SetRangeParameter( |
| 56 speed_factor_.GetValue()); | 58 PARAM_RANGE_SPEED_SENSITIVITY, |
| 59 speed_factor_.GetValue()); |
| 57 if (!pref_name || *pref_name == prefs::kTouchpadSensitivity) | 60 if (!pref_name || *pref_name == prefs::kTouchpadSensitivity) |
| 58 SynapticsLibrary::Get()->SetRangeParameter(PARAM_RANGE_TOUCH_SENSITIVITY, | 61 CrosLibrary::Get()->GetSynapticsLibrary()->SetRangeParameter( |
| 59 sensitivity_.GetValue()); | 62 PARAM_RANGE_TOUCH_SENSITIVITY, |
| 63 sensitivity_.GetValue()); |
| 60 } | 64 } |
| 61 | 65 |
| 62 void Preferences::SetTimeZone(const std::wstring& id) { | 66 void Preferences::SetTimeZone(const std::wstring& id) { |
| 63 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 67 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
| 64 icu::UnicodeString::fromUTF8(WideToASCII(id))); | 68 icu::UnicodeString::fromUTF8(WideToASCII(id))); |
| 65 icu::TimeZone::adoptDefault(timezone); | 69 icu::TimeZone::adoptDefault(timezone); |
| 66 } | 70 } |
| 67 | 71 |
| 68 } // namespace chromeos | 72 } // namespace chromeos |
| OLD | NEW |