diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/system_page_view.cc | 73 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/preferences.h | 1 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
6 files changed, 86 insertions, 0 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 158898b..cb8c42c 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -7401,6 +7401,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_LANGUAGE"> Language </message> + <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY"> + Accessibility + </message> <message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_WIFI_CONFIG"> Wireless </message> @@ -7422,6 +7425,9 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_OPTIONS_SETTINGS_SPEED_FACTOR_DESCRIPTION" desc="In the settings tab, the text next to the slider for the touchpad speed factor."> Speed Sensitivity: </message> + <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for accessbility."> + Enable Accessibility + </message> <message name="IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT" desc="In the settings tab, the text of the keyboard layouti label."> Keyboard Layout: </message> diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc index 52f6872..7b5c27a 100644 --- a/chrome/browser/chromeos/options/system_page_view.cc +++ b/chrome/browser/chromeos/options/system_page_view.cc @@ -388,6 +388,7 @@ void LanguageSection::InitContents(GridLayout* layout) { customize_languages_button->set_tag(kCustomizeLanguagesButton); layout->AddView(customize_languages_button, 1, 1, GridLayout::LEADING, GridLayout::CENTER); + layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); } void LanguageSection::ButtonPressed( @@ -397,6 +398,75 @@ void LanguageSection::ButtonPressed( } } +/////////////////////////////////////////////////////////////////////////////// +// AccessibilitySection + +// Checkbox for specifying if accessibility should be enabled for this profile +class AccessibilitySection : public SettingsPageSection, + public views::ButtonListener { + public: + explicit AccessibilitySection(Profile* profile); + virtual ~AccessibilitySection() {} + + protected: + // Overridden from views::ButtonListener: + virtual void ButtonPressed(views::Button* sender, + const views::Event& event); + + // Overridden from SettingsPageSection: + virtual void InitContents(GridLayout* layout); + virtual void NotifyPrefChanged(const std::wstring* pref_name); + + private: + // The View that contains the contents of the section. + views::View* contents_; + + // Controls for this section: + views::Checkbox* accessibility_checkbox_; + + // Preferences for this section: + BooleanPrefMember accessibility_enabled_; + + DISALLOW_COPY_AND_ASSIGN(AccessibilitySection); +}; + +AccessibilitySection::AccessibilitySection(Profile* profile) + : SettingsPageSection(profile, + IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY), + accessibility_checkbox_(NULL) { +} + +void AccessibilitySection::InitContents(GridLayout* layout) { + accessibility_checkbox_ = new views::Checkbox(l10n_util::GetString( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); + accessibility_checkbox_->set_listener(this); + accessibility_checkbox_->SetMultiLine(true); + + layout->StartRow(0, double_column_view_set_id()); + layout->AddView(accessibility_checkbox_); + layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); + + // Init member prefs so we can update the controls if prefs change. + accessibility_enabled_.Init(prefs::kAccessibilityEnabled, + profile()->GetPrefs(), this); +} + +void AccessibilitySection::ButtonPressed( + views::Button* sender, const views::Event& event) { + if (sender == accessibility_checkbox_) { + bool enabled = accessibility_checkbox_->checked(); + // Set the accessibility enabled value in profile/prefs + accessibility_enabled_.SetValue(enabled); + } +} + +void AccessibilitySection::NotifyPrefChanged(const std::wstring* pref_name) { + if (!pref_name || *pref_name == prefs::kAccessibilityEnabled) { + bool enabled = accessibility_enabled_.GetValue(); + accessibility_checkbox_->SetChecked(enabled); + } +} + //////////////////////////////////////////////////////////////////////////////// // SystemPageView @@ -421,6 +491,9 @@ void SystemPageView::InitControlLayout() { layout->StartRow(0, single_column_view_set_id); layout->AddView(new LanguageSection(profile())); layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + layout->StartRow(0, single_column_view_set_id); + layout->AddView(new AccessibilitySection(profile())); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); } } // namespace chromeos diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 8be1373..f783138 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -21,6 +21,7 @@ namespace chromeos { void Preferences::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterStringPref(prefs::kTimeZone, L"US/Pacific"); prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, false); + prefs->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); prefs->RegisterBooleanPref(prefs::kVertEdgeScrollEnabled, false); prefs->RegisterIntegerPref(prefs::kTouchpadSpeedFactor, 9); prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, 5); @@ -49,6 +50,7 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { void Preferences::Init(PrefService* prefs) { timezone_.Init(prefs::kTimeZone, prefs, this); tap_to_click_enabled_.Init(prefs::kTapToClickEnabled, prefs, this); + accessibility_enabled_.Init(prefs::kAccessibilityEnabled, prefs, this); vert_edge_scroll_enabled_.Init(prefs::kVertEdgeScrollEnabled, prefs, this); speed_factor_.Init(prefs::kTouchpadSpeedFactor, prefs, this); sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, this); diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h index 418259a..2617bd1 100644 --- a/chrome/browser/chromeos/preferences.h +++ b/chrome/browser/chromeos/preferences.h @@ -79,6 +79,7 @@ class Preferences : public NotificationObserver { StringPrefMember timezone_; BooleanPrefMember tap_to_click_enabled_; BooleanPrefMember vert_edge_scroll_enabled_; + BooleanPrefMember accessibility_enabled_; IntegerPrefMember speed_factor_; IntegerPrefMember sensitivity_; diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index a313944..a4040ae 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -254,6 +254,9 @@ const wchar_t kLanguageMozcPunctuationMethod[] = L"settings.language.mozc_punctuation_method"; const wchar_t kLanguageMozcSymbolMethod[] = L"settings.language.mozc_symbol_method"; + +// A boolean pref which determines whether accessibility is enabled. +const wchar_t kAccessibilityEnabled[] = L"settings.accessibility"; #endif // The disabled messages in IPC logging. diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index dc2199a..69533ee8 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -95,6 +95,7 @@ extern const wchar_t kLanguageMozcPreeditMethod[]; extern const wchar_t kLanguageMozcSessionKeymap[]; extern const wchar_t kLanguageMozcPunctuationMethod[]; extern const wchar_t kLanguageMozcSymbolMethod[]; +extern const wchar_t kAccessibilityEnabled[]; #endif extern const wchar_t kIpcDisabledMessages[]; extern const wchar_t kShowHomeButton[]; |