Chromium Code Reviews| 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 "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 prefs_ = prefs; | 296 prefs_ = prefs; |
| 297 | 297 |
| 298 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); | 298 tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); |
| 299 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, | 299 three_finger_click_enabled_.Init(prefs::kEnableTouchpadThreeFingerClick, |
| 300 prefs, this); | 300 prefs, this); |
| 301 natural_scroll_.Init(prefs::kNaturalScroll, prefs, this); | 301 natural_scroll_.Init(prefs::kNaturalScroll, prefs, this); |
| 302 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); | 302 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, this); |
| 303 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, this); | 303 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, this); |
| 304 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); | 304 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); |
| 305 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); | 305 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, this); |
| 306 disable_gdata_.Init(prefs::kDisableGData, prefs, this); | 306 disable_drive_.Init(prefs::kDisableGData, prefs, this); |
| 307 disable_gdata_over_cellular_.Init(prefs::kDisableGDataOverCellular, | 307 disable_drive_over_cellular_.Init(prefs::kDisableGDataOverCellular, |
| 308 prefs, this); | 308 prefs, this); |
| 309 disable_gdata_hosted_files_.Init(prefs::kDisableGDataHostedFiles, | 309 disable_drive_hosted_files_.Init(prefs::kDisableGDataHostedFiles, |
| 310 prefs, this); | 310 prefs, this); |
| 311 download_default_directory_.Init(prefs::kDownloadDefaultDirectory, | |
| 312 prefs, this); | |
|
xiyuan
2012/08/27 16:17:28
nit: same alignment as code around this?
achuithb
2012/08/27 21:35:20
Oops, done.
| |
| 311 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, | 313 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, |
| 312 prefs, this); | 314 prefs, this); |
| 313 preferred_languages_.Init(prefs::kLanguagePreferredLanguages, | 315 preferred_languages_.Init(prefs::kLanguagePreferredLanguages, |
| 314 prefs, this); | 316 prefs, this); |
| 315 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this); | 317 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this); |
| 316 current_input_method_.Init(prefs::kLanguageCurrentInputMethod, prefs, this); | 318 current_input_method_.Init(prefs::kLanguageCurrentInputMethod, prefs, this); |
| 317 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod, prefs, this); | 319 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod, prefs, this); |
| 318 | 320 |
| 319 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { | 321 for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { |
| 320 chewing_boolean_prefs_[i].Init( | 322 chewing_boolean_prefs_[i].Init( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 } | 448 } |
| 447 } | 449 } |
| 448 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { | 450 if (!pref_name || *pref_name == prefs::kPrimaryMouseButtonRight) { |
| 449 const bool right = primary_mouse_button_right_.GetValue(); | 451 const bool right = primary_mouse_button_right_.GetValue(); |
| 450 system::mouse_settings::SetPrimaryButtonRight(right); | 452 system::mouse_settings::SetPrimaryButtonRight(right); |
| 451 if (pref_name) | 453 if (pref_name) |
| 452 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); | 454 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Changed", right); |
| 453 else | 455 else |
| 454 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); | 456 UMA_HISTOGRAM_BOOLEAN("Mouse.PrimaryButtonRight.Started", right); |
| 455 } | 457 } |
| 458 if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { | |
| 459 const bool default_download_to_drive = gdata::util::IsUnderGDataMountPoint( | |
| 460 download_default_directory_.GetValue()); | |
| 461 if (pref_name) | |
| 462 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Changed", | |
| 463 default_download_to_drive); | |
| 464 else | |
| 465 UMA_HISTOGRAM_BOOLEAN("FileBrowser.DownloadDestination.IsDrive.Started", | |
| 466 default_download_to_drive); | |
| 467 } | |
| 456 | 468 |
| 457 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { | 469 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { |
| 458 // Unlike kLanguagePreloadEngines and some other input method | 470 // Unlike kLanguagePreloadEngines and some other input method |
| 459 // preferencs, we don't need to send this to ibus-daemon. | 471 // preferencs, we don't need to send this to ibus-daemon. |
| 460 } | 472 } |
| 461 | 473 |
| 462 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { | 474 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { |
| 463 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); | 475 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); |
| 464 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); | 476 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); |
| 465 } | 477 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 } | 612 } |
| 601 | 613 |
| 602 // Init or update protected content (DRM) support. | 614 // Init or update protected content (DRM) support. |
| 603 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { | 615 if (!pref_name || *pref_name == prefs::kEnableCrosDRM) { |
| 604 system::ToggleDrm(enable_drm_.GetValue()); | 616 system::ToggleDrm(enable_drm_.GetValue()); |
| 605 } | 617 } |
| 606 | 618 |
| 607 // Change the download directory to the default value if a GData directory is | 619 // Change the download directory to the default value if a GData directory is |
| 608 // selected and GData is disabled. | 620 // selected and GData is disabled. |
| 609 if (!pref_name || *pref_name == prefs::kDisableGData) { | 621 if (!pref_name || *pref_name == prefs::kDisableGData) { |
| 610 if (disable_gdata_.GetValue()) { | 622 if (disable_drive_.GetValue()) { |
| 611 const FilePath download_path = | 623 if (gdata::util::IsUnderGDataMountPoint( |
| 612 prefs_->GetFilePath(prefs::kDownloadDefaultDirectory); | 624 download_default_directory_.GetValue())) { |
| 613 if (gdata::util::IsUnderGDataMountPoint(download_path)) { | |
| 614 prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, | 625 prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, |
| 615 download_util::GetDefaultDownloadDirectory()); | 626 download_util::GetDefaultDownloadDirectory()); |
| 616 } | 627 } |
| 617 } | 628 } |
| 618 } | 629 } |
| 619 } | 630 } |
| 620 | 631 |
| 621 void Preferences::SetLanguageConfigBoolean(const char* section, | 632 void Preferences::SetLanguageConfigBoolean(const char* section, |
| 622 const char* name, | 633 const char* name, |
| 623 bool value) { | 634 bool value) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 | 720 |
| 710 input_method::AutoRepeatRate rate; | 721 input_method::AutoRepeatRate rate; |
| 711 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 722 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
| 712 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 723 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
| 713 DCHECK(rate.initial_delay_in_ms > 0); | 724 DCHECK(rate.initial_delay_in_ms > 0); |
| 714 DCHECK(rate.repeat_interval_in_ms > 0); | 725 DCHECK(rate.repeat_interval_in_ms > 0); |
| 715 input_method::XKeyboard::SetAutoRepeatRate(rate); | 726 input_method::XKeyboard::SetAutoRepeatRate(rate); |
| 716 } | 727 } |
| 717 | 728 |
| 718 } // namespace chromeos | 729 } // namespace chromeos |
| OLD | NEW |