| 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" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 prefs_ = prefs; | 286 prefs_ = prefs; |
| 287 | 287 |
| 288 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); | 288 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); |
| 289 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, | 289 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, |
| 290 prefs, this); | 290 prefs, this); |
| 291 natural_scroll_.Init(prefs::kNaturalScroll, prefs, this); | 291 natural_scroll_.Init(prefs::kNaturalScroll, prefs, this); |
| 292 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); | 292 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); |
| 293 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, this); | 293 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, this); |
| 294 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); | 294 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); |
| 295 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); | 295 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); |
| 296 disable_gdata_.Init(prefs::kDisableGData, prefs, this); | 296 disable_drive_.Init(prefs::kDisableGData, prefs, this); |
| 297 disable_gdata_over_cellular_.Init(prefs::kDisableGDataOverCellular, | 297 disable_drive_over_cellular_.Init(prefs::kDisableGDataOverCellular, |
| 298 prefs, this); | 298 prefs, this); |
| 299 disable_gdata_hosted_files_.Init(prefs::kDisableGDataHostedFiles, | 299 disable_drive_hosted_files_.Init(prefs::kDisableGDataHostedFiles, |
| 300 prefs, this); |
| 301 download_default_directory_.Init(prefs::kDownloadDefaultDirectory, |
| 300 prefs, this); | 302 prefs, this); |
| 301 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, | 303 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, |
| 302 prefs, this); | 304 prefs, this); |
| 303 preferred_languages_.Init(prefs::kLanguagePreferredLanguages, | 305 preferred_languages_.Init(prefs::kLanguagePreferredLanguages, |
| 304 prefs, this); | 306 prefs, this); |
| 305 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this); | 307 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this); |
| 306 current_input_method_.Init(prefs::kLanguageCurrentInputMethod, prefs, this); | 308 current_input_method_.Init(prefs::kLanguageCurrentInputMethod, prefs, this); |
| 307 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod, prefs, this); | 309 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod, prefs, this); |
| 308 | 310 |
| 309 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { | 311 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 437 } |
| 436 } | 438 } |
| 437 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { | 439 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { |
| 438 const bool right = primary_mouse_button_right_.GetValue(); | 440 const bool right = primary_mouse_button_right_.GetValue(); |
| 439 system::mouse_settings::SetPrimaryButtonRight(right); | 441 system::mouse_settings::SetPrimaryButtonRight(right); |
| 440 if (pref_name) | 442 if (pref_name) |
| 441 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); | 443 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); |
| 442 else | 444 else |
| 443 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); | 445 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); |
| 444 } | 446 } |
| 447 if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { |
| 448 const bool default_download_to_drive = gdata::util::IsUnderDriveMountPoint( |
| 449 download_default_directory_.GetValue()); |
| 450 if (pref_name) |
| 451 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Changed", |
| 452 default_download_to_drive); |
| 453 else |
| 454 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Started", |
| 455 default_download_to_drive); |
| 456 } |
| 445 | 457 |
| 446 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { | 458 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { |
| 447 // Unlike kLanguagePreloadEngines and some other input method | 459 // Unlike kLanguagePreloadEngines and some other input method |
| 448 // preferencs, we don't need to send this to ibus-daemon. | 460 // preferencs, we don't need to send this to ibus-daemon. |
| 449 } | 461 } |
| 450 | 462 |
| 451 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { | 463 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { |
| 452 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); | 464 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); |
| 453 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); | 465 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); |
| 454 } | 466 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 586 } |
| 575 | 587 |
| 576 // Init or update protected content (DRM) support. | 588 // Init or update protected content (DRM) support. |
| 577 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { | 589 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { |
| 578 system::ToggleDrm(enable_drm_.GetValue()); | 590 system::ToggleDrm(enable_drm_.GetValue()); |
| 579 } | 591 } |
| 580 | 592 |
| 581 // Change the download directory to the default value if a GData directory is | 593 // Change the download directory to the default value if a GData directory is |
| 582 // selected and GData is disabled. | 594 // selected and GData is disabled. |
| 583 if (!pref_name || *pref_name == prefs::kDisableGData) { | 595 if (!pref_name || *pref_name == prefs::kDisableGData) { |
| 584 if (disable_gdata_.GetValue()) { | 596 if (disable_drive_.GetValue()) { |
| 585 const FilePath download_path = | 597 if (gdata::util::IsUnderDriveMountPoint( |
| 586 prefs_->GetFilePath(prefs::kDownloadDefaultDirectory); | 598 download_default_directory_.GetValue())) { |
| 587 if (gdata::util::IsUnderDriveMountPoint(download_path)) { | |
| 588 prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, | 599 prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, |
| 589 download_util::GetDefaultDownloadDirectory()); | 600 download_util::GetDefaultDownloadDirectory()); |
| 590 } | 601 } |
| 591 } | 602 } |
| 592 } | 603 } |
| 593 } | 604 } |
| 594 | 605 |
| 595 void Preferences::SetLanguageConfigBoolean(const char* section, | 606 void Preferences::SetLanguageConfigBoolean(const char* section, |
| 596 const char* name, | 607 const char* name, |
| 597 bool value) { | 608 bool value) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 694 |
| 684 input_method::AutoRepeatRate rate; | 695 input_method::AutoRepeatRate rate; |
| 685 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 696 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
| 686 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 697 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
| 687 DCHECK(rate.initial_delay_in_ms > 0); | 698 DCHECK(rate.initial_delay_in_ms > 0); |
| 688 DCHECK(rate.repeat_interval_in_ms > 0); | 699 DCHECK(rate.repeat_interval_in_ms > 0); |
| 689 input_method::XKeyboard::SetAutoRepeatRate(rate); | 700 input_method::XKeyboard::SetAutoRepeatRate(rate); |
| 690 } | 701 } |
| 691 | 702 |
| 692 } // namespace chromeos | 703 } // namespace chromeos |
| OLD | NEW |