| 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/magnifier/magnifier_constants.h" | 7 #include "ash/magnifier/magnifier_constants.h" |
| 8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, callback); | 361 mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, callback); |
| 362 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, callback); | 362 touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, callback); |
| 363 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, callback); | 363 use_24hour_clock_.Init(prefs::kUse24HourClock, prefs, callback); |
| 364 disable_drive_.Init(prefs::kDisableDrive, prefs, callback); | 364 disable_drive_.Init(prefs::kDisableDrive, prefs, callback); |
| 365 disable_drive_over_cellular_.Init(prefs::kDisableDriveOverCellular, | 365 disable_drive_over_cellular_.Init(prefs::kDisableDriveOverCellular, |
| 366 prefs, callback); | 366 prefs, callback); |
| 367 disable_drive_hosted_files_.Init(prefs::kDisableDriveHostedFiles, | 367 disable_drive_hosted_files_.Init(prefs::kDisableDriveHostedFiles, |
| 368 prefs, callback); | 368 prefs, callback); |
| 369 download_default_directory_.Init(prefs::kDownloadDefaultDirectory, | 369 download_default_directory_.Init(prefs::kDownloadDefaultDirectory, |
| 370 prefs, callback); | 370 prefs, callback); |
| 371 select_file_last_directory_.Init(prefs::kSelectFileLastDirectory, |
| 372 prefs, callback); |
| 371 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, | 373 primary_mouse_button_right_.Init(prefs::kPrimaryMouseButtonRight, |
| 372 prefs, callback); | 374 prefs, callback); |
| 373 preferred_languages_.Init(prefs::kLanguagePreferredLanguages, | 375 preferred_languages_.Init(prefs::kLanguagePreferredLanguages, |
| 374 prefs, callback); | 376 prefs, callback); |
| 375 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, callback); | 377 preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, callback); |
| 376 filtered_extension_imes_.Init(prefs::kLanguageFilteredExtensionImes, | 378 filtered_extension_imes_.Init(prefs::kLanguageFilteredExtensionImes, |
| 377 prefs, callback); | 379 prefs, callback); |
| 378 current_input_method_.Init(prefs::kLanguageCurrentInputMethod, | 380 current_input_method_.Init(prefs::kLanguageCurrentInputMethod, |
| 379 prefs, callback); | 381 prefs, callback); |
| 380 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod, | 382 previous_input_method_.Init(prefs::kLanguagePreviousInputMethod, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 576 |
| 575 // Save owner preference in local state to use on login screen. | 577 // Save owner preference in local state to use on login screen. |
| 576 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { | 578 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { |
| 577 PrefService* prefs = g_browser_process->local_state(); | 579 PrefService* prefs = g_browser_process->local_state(); |
| 578 if (prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight) != right) | 580 if (prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight) != right) |
| 579 prefs->SetBoolean(prefs::kOwnerPrimaryMouseButtonRight, right); | 581 prefs->SetBoolean(prefs::kOwnerPrimaryMouseButtonRight, right); |
| 580 } | 582 } |
| 581 } | 583 } |
| 582 if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { | 584 if (!pref_name || *pref_name == prefs::kDownloadDefaultDirectory) { |
| 583 const base::FilePath pref_path = download_default_directory_.GetValue(); | 585 const base::FilePath pref_path = download_default_directory_.GetValue(); |
| 586 // TODO(haruki): Remove this when migration completes. crbug.com/229304. |
| 584 if (drive::util::NeedsNamespaceMigration(pref_path)) { | 587 if (drive::util::NeedsNamespaceMigration(pref_path)) { |
| 585 prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, | 588 prefs_->SetFilePath(prefs::kDownloadDefaultDirectory, |
| 586 drive::util::ConvertToMyDriveNamespace(pref_path)); | 589 drive::util::ConvertToMyDriveNamespace(pref_path)); |
| 587 } | 590 } |
| 588 | 591 |
| 589 const bool default_download_to_drive = drive::util::IsUnderDriveMountPoint( | 592 const bool default_download_to_drive = drive::util::IsUnderDriveMountPoint( |
| 590 download_default_directory_.GetValue()); | 593 download_default_directory_.GetValue()); |
| 591 if (pref_name) | 594 if (pref_name) |
| 592 UMA_HISTOGRAM_BOOLEAN( | 595 UMA_HISTOGRAM_BOOLEAN( |
| 593 "FileBrowser.DownloadDestination.IsGoogleDrive.Changed", | 596 "FileBrowser.DownloadDestination.IsGoogleDrive.Changed", |
| 594 default_download_to_drive); | 597 default_download_to_drive); |
| 595 else | 598 else |
| 596 UMA_HISTOGRAM_BOOLEAN( | 599 UMA_HISTOGRAM_BOOLEAN( |
| 597 "FileBrowser.DownloadDestination.IsGoogleDrive.Started", | 600 "FileBrowser.DownloadDestination.IsGoogleDrive.Started", |
| 598 default_download_to_drive); | 601 default_download_to_drive); |
| 599 } | 602 } |
| 603 if (!pref_name || *pref_name == prefs::kSelectFileLastDirectory) { |
| 604 const base::FilePath pref_path = select_file_last_directory_.GetValue(); |
| 605 // This pref can contain a Drive path, which needs to be updated due to |
| 606 // namespaces introduced by crbug.com/174233. |
| 607 // TODO(haruki): Remove this when migration completes. crbug.com/229304. |
| 608 if (drive::util::NeedsNamespaceMigration(pref_path)) { |
| 609 prefs_->SetFilePath(prefs::kSelectFileLastDirectory, |
| 610 drive::util::ConvertToMyDriveNamespace(pref_path)); |
| 611 } |
| 612 } |
| 600 | 613 |
| 601 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { | 614 if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) { |
| 602 // Unlike kLanguagePreloadEngines and some other input method | 615 // Unlike kLanguagePreloadEngines and some other input method |
| 603 // preferencs, we don't need to send this to ibus-daemon. | 616 // preferencs, we don't need to send this to ibus-daemon. |
| 604 } | 617 } |
| 605 | 618 |
| 606 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { | 619 if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) { |
| 607 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); | 620 const bool enabled = xkb_auto_repeat_enabled_.GetValue(); |
| 608 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); | 621 input_method::XKeyboard::SetAutoRepeatEnabled(enabled); |
| 609 } | 622 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 905 |
| 893 input_method::AutoRepeatRate rate; | 906 input_method::AutoRepeatRate rate; |
| 894 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); | 907 rate.initial_delay_in_ms = xkb_auto_repeat_delay_pref_.GetValue(); |
| 895 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); | 908 rate.repeat_interval_in_ms = xkb_auto_repeat_interval_pref_.GetValue(); |
| 896 DCHECK(rate.initial_delay_in_ms > 0); | 909 DCHECK(rate.initial_delay_in_ms > 0); |
| 897 DCHECK(rate.repeat_interval_in_ms > 0); | 910 DCHECK(rate.repeat_interval_in_ms > 0); |
| 898 input_method::XKeyboard::SetAutoRepeatRate(rate); | 911 input_method::XKeyboard::SetAutoRepeatRate(rate); |
| 899 } | 912 } |
| 900 | 913 |
| 901 } // namespace chromeos | 914 } // namespace chromeos |
| OLD | NEW |