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/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
6 | 6 |
7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 14 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
15 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 15 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
16 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 16 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
17 #include "chrome/browser/chromeos/login/login_utils.h" | 17 #include "chrome/browser/chromeos/login/login_utils.h" |
| 18 #include "chrome/browser/chromeos/system/drm_settings.h" |
18 #include "chrome/browser/chromeos/system/input_device_settings.h" | 19 #include "chrome/browser/chromeos/system/input_device_settings.h" |
19 #include "chrome/browser/chromeos/system/screen_locker_settings.h" | 20 #include "chrome/browser/chromeos/system/screen_locker_settings.h" |
20 #include "chrome/browser/prefs/pref_member.h" | 21 #include "chrome/browser/prefs/pref_member.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 23 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
23 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
26 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
27 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 true, | 245 true, |
245 PrefService::UNSYNCABLE_PREF); | 246 PrefService::UNSYNCABLE_PREF); |
246 | 247 |
247 // OAuth1 all access token and secret pair. | 248 // OAuth1 all access token and secret pair. |
248 prefs->RegisterStringPref(prefs::kOAuth1Token, | 249 prefs->RegisterStringPref(prefs::kOAuth1Token, |
249 "", | 250 "", |
250 PrefService::UNSYNCABLE_PREF); | 251 PrefService::UNSYNCABLE_PREF); |
251 prefs->RegisterStringPref(prefs::kOAuth1Secret, | 252 prefs->RegisterStringPref(prefs::kOAuth1Secret, |
252 "", | 253 "", |
253 PrefService::UNSYNCABLE_PREF); | 254 PrefService::UNSYNCABLE_PREF); |
| 255 |
| 256 // TODO(wad): Once UI is connected, a final default can be set. At that point |
| 257 // change this pref from UNSYNCABLE to SYNCABLE. |
| 258 prefs->RegisterBooleanPref(prefs::kEnableCrosDRM, |
| 259 true, |
| 260 PrefService::UNSYNCABLE_PREF); |
254 } | 261 } |
255 | 262 |
256 // static | 263 // static |
257 void Preferences::SetDefaultOSSettings() { | 264 void Preferences::SetDefaultOSSettings() { |
258 system::touchpad_settings::SetTapToClick(kDefaultTapToClickEnabled); | 265 system::touchpad_settings::SetTapToClick(kDefaultTapToClickEnabled); |
259 ui::SetNaturalScroll(kDefaultNaturalScrollEnabled); | 266 ui::SetNaturalScroll(kDefaultNaturalScrollEnabled); |
260 } | 267 } |
261 | 268 |
262 void Preferences::InitUserPrefs(PrefService* prefs) { | 269 void Preferences::InitUserPrefs(PrefService* prefs) { |
263 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); | 270 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 xkb_remap_alt_key_to_.Init( | 334 xkb_remap_alt_key_to_.Init( |
328 prefs::kLanguageXkbRemapAltKeyTo, prefs, this); | 335 prefs::kLanguageXkbRemapAltKeyTo, prefs, this); |
329 xkb_auto_repeat_enabled_.Init( | 336 xkb_auto_repeat_enabled_.Init( |
330 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); | 337 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); |
331 xkb_auto_repeat_delay_pref_.Init( | 338 xkb_auto_repeat_delay_pref_.Init( |
332 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); | 339 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); |
333 xkb_auto_repeat_interval_pref_.Init( | 340 xkb_auto_repeat_interval_pref_.Init( |
334 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); | 341 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); |
335 | 342 |
336 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); | 343 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); |
| 344 |
| 345 enable_drm_.Init(prefs::kEnableCrosDRM, prefs, this); |
337 } | 346 } |
338 | 347 |
339 void Preferences::Init(PrefService* prefs) { | 348 void Preferences::Init(PrefService* prefs) { |
340 InitUserPrefs(prefs); | 349 InitUserPrefs(prefs); |
341 | 350 |
342 // Initialize preferences to currently saved state. | 351 // Initialize preferences to currently saved state. |
343 NotifyPrefChanged(NULL); | 352 NotifyPrefChanged(NULL); |
344 | 353 |
345 // Initialize virtual keyboard settings to currently saved state. | 354 // Initialize virtual keyboard settings to currently saved state. |
346 UpdateVirturalKeyboardPreference(prefs); | 355 UpdateVirturalKeyboardPreference(prefs); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 language_prefs::kMozcIntegerPrefs[i].ibus_config_name, | 564 language_prefs::kMozcIntegerPrefs[i].ibus_config_name, |
556 mozc_integer_prefs_[i].GetValue()); | 565 mozc_integer_prefs_[i].GetValue()); |
557 } | 566 } |
558 } | 567 } |
559 | 568 |
560 // Init or update power manager config. | 569 // Init or update power manager config. |
561 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { | 570 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { |
562 system::screen_locker_settings::EnableScreenLock( | 571 system::screen_locker_settings::EnableScreenLock( |
563 enable_screen_lock_.GetValue()); | 572 enable_screen_lock_.GetValue()); |
564 } | 573 } |
| 574 |
| 575 // Init or update protected content (DRM) support. |
| 576 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { |
| 577 system::drm_settings::ToggleDrm( |
| 578 enable_drm_.GetValue()); |
| 579 } |
| 580 |
565 } | 581 } |
566 | 582 |
567 void Preferences::SetLanguageConfigBoolean(const char* section, | 583 void Preferences::SetLanguageConfigBoolean(const char* section, |
568 const char* name, | 584 const char* name, |
569 bool value) { | 585 bool value) { |
570 input_method::InputMethodConfigValue config; | 586 input_method::InputMethodConfigValue config; |
571 config.type = input_method::InputMethodConfigValue::kValueTypeBool; | 587 config.type = input_method::InputMethodConfigValue::kValueTypeBool; |
572 config.bool_value = value; | 588 config.bool_value = value; |
573 input_method_manager_->SetInputMethodConfig(section, name, config); | 589 input_method_manager_->SetInputMethodConfig(section, name, config); |
574 } | 590 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 | 725 |
710 // Remove invalid prefs. | 726 // Remove invalid prefs. |
711 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); | 727 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); |
712 DictionaryValue* pref_value = updater.Get(); | 728 DictionaryValue* pref_value = updater.Get(); |
713 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { | 729 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { |
714 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); | 730 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); |
715 } | 731 } |
716 } | 732 } |
717 | 733 |
718 } // namespace chromeos | 734 } // namespace chromeos |
OLD | NEW |