summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-03 14:22:56 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-03 14:22:56 +0000
commit5c85d5d2eb04d08aa38362889fbc18c89ce68c15 (patch)
tree4e2feec5872cea989ccae17024633eb2968a3e2e
parent519d22910fd5ee9944e988987513277558564246 (diff)
downloadchromium_src-5c85d5d2eb04d08aa38362889fbc18c89ce68c15.zip
chromium_src-5c85d5d2eb04d08aa38362889fbc18c89ce68c15.tar.gz
chromium_src-5c85d5d2eb04d08aa38362889fbc18c89ce68c15.tar.bz2
A11y: Add the option to always show the a11y tray menu regardless of the state of a11y features
Change summary: - Add 'const' to ShellDelegate::IsUserLoggedIn() - Use TrayImageItem::UpdateAfterLoginStatusChange delegate instead of ShellObserver::OnLoginStateChanged() - Add a pref: kShouldAlwaysShowAccessibilityMenu - Add a checkbox to chrome://settings BUG=158287 TEST=manual Review URL: https://chromiumcodereview.appspot.com/11280236 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170732 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/shell/shell_delegate_impl.cc8
-rw-r--r--ash/shell/shell_delegate_impl.h8
-rw-r--r--ash/shell_delegate.h8
-rw-r--r--ash/system/tray_accessibility.cc5
-rw-r--r--ash/system/tray_accessibility.h7
-rw-r--r--ash/test/test_shell_delegate.cc8
-rw-r--r--ash/test/test_shell_delegate.h8
-rw-r--r--chrome/app/chromeos_strings.grdp3
-rw-r--r--chrome/browser/chromeos/preferences.cc6
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc4
-rw-r--r--chrome/browser/resources/options/browser_options.html9
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.cc20
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.h8
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc2
-rw-r--r--chrome/common/pref_names.cc3
-rw-r--r--chrome/common/pref_names.h1
16 files changed, 69 insertions, 39 deletions
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 1d569c8..1edc9d1 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -36,19 +36,19 @@ void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
launcher_delegate_->set_watcher(watcher);
}
-bool ShellDelegateImpl::IsUserLoggedIn() {
+bool ShellDelegateImpl::IsUserLoggedIn() const {
return true;
}
-bool ShellDelegateImpl::IsSessionStarted() {
+bool ShellDelegateImpl::IsSessionStarted() const {
return true;
}
-bool ShellDelegateImpl::IsFirstRunAfterBoot() {
+bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
return false;
}
-bool ShellDelegateImpl::CanLockScreen() {
+bool ShellDelegateImpl::CanLockScreen() const {
return true;
}
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 555e87f..3dd663e0a 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -21,10 +21,10 @@ class ShellDelegateImpl : public ash::ShellDelegate {
void SetWatcher(WindowWatcher* watcher);
- virtual bool IsUserLoggedIn() OVERRIDE;
- virtual bool IsSessionStarted() OVERRIDE;
- virtual bool IsFirstRunAfterBoot() OVERRIDE;
- virtual bool CanLockScreen() OVERRIDE;
+ virtual bool IsUserLoggedIn() const OVERRIDE;
+ virtual bool IsSessionStarted() const OVERRIDE;
+ virtual bool IsFirstRunAfterBoot() const OVERRIDE;
+ virtual bool CanLockScreen() const OVERRIDE;
virtual void LockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
virtual bool IsScreenLocked() const OVERRIDE;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index 2b067d745..a7eb838 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -67,19 +67,19 @@ class ASH_EXPORT ShellDelegate {
virtual ~ShellDelegate() {}
// Returns true if user has logged in.
- virtual bool IsUserLoggedIn() = 0;
+ virtual bool IsUserLoggedIn() const = 0;
// Returns true if we're logged in and browser has been started
- virtual bool IsSessionStarted() = 0;
+ virtual bool IsSessionStarted() const = 0;
// Returns true if this is the first time that the shell has been run after
// the system has booted. false is returned after the shell has been
// restarted, typically due to logging in as a guest or logging out.
- virtual bool IsFirstRunAfterBoot() = 0;
+ virtual bool IsFirstRunAfterBoot() const = 0;
// Returns true if a user is logged in whose session can be locked (i.e. the
// user has a password with which to unlock the session).
- virtual bool CanLockScreen() = 0;
+ virtual bool CanLockScreen() const = 0;
// Invoked when a user locks the screen.
virtual void LockScreen() = 0;
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc
index 5474e4e..5ef1aeb 100644
--- a/ash/system/tray_accessibility.cc
+++ b/ash/system/tray_accessibility.cc
@@ -227,12 +227,9 @@ TrayAccessibility::TrayAccessibility(SystemTray* system_tray)
login_(GetCurrentLoginStatus()) {
DCHECK(Shell::GetInstance()->delegate());
DCHECK(system_tray);
-
- Shell::GetInstance()->AddShellObserver(this);
}
TrayAccessibility::~TrayAccessibility() {
- Shell::GetInstance()->RemoveShellObserver(this);
}
bool TrayAccessibility::GetInitialVisibility() {
@@ -286,7 +283,7 @@ void TrayAccessibility::DestroyDetailedView() {
detailed_ = NULL;
}
-void TrayAccessibility::OnLoginStateChanged(user::LoginStatus status) {
+void TrayAccessibility::UpdateAfterLoginStatusChange(user::LoginStatus status) {
login_ = status;
if (tray_view())
diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h
index 1ee1aab..e0162f5 100644
--- a/ash/system/tray_accessibility.h
+++ b/ash/system/tray_accessibility.h
@@ -26,8 +26,7 @@ class ASH_EXPORT AccessibilityObserver {
namespace internal {
class TrayAccessibility : public TrayImageItem,
- public AccessibilityObserver,
- public ShellObserver {
+ public AccessibilityObserver {
public:
explicit TrayAccessibility(SystemTray* system_tray);
virtual ~TrayAccessibility();
@@ -39,13 +38,11 @@ class TrayAccessibility : public TrayImageItem,
virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
virtual void DestroyDefaultView() OVERRIDE;
virtual void DestroyDetailedView() OVERRIDE;
+ virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE;
// Overridden from AccessibilityObserver.
virtual void OnAccessibilityModeChanged() OVERRIDE;
- // Overriden from ShellObserver.
- virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
-
views::View* default_;
views::View* detailed_;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index e3aac46..4af4eb3 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -33,19 +33,19 @@ TestShellDelegate::TestShellDelegate()
TestShellDelegate::~TestShellDelegate() {
}
-bool TestShellDelegate::IsUserLoggedIn() {
+bool TestShellDelegate::IsUserLoggedIn() const {
return user_logged_in_;
}
-bool TestShellDelegate::IsSessionStarted() {
+bool TestShellDelegate::IsSessionStarted() const {
return session_started_;
}
-bool TestShellDelegate::IsFirstRunAfterBoot() {
+bool TestShellDelegate::IsFirstRunAfterBoot() const {
return false;
}
-bool TestShellDelegate::CanLockScreen() {
+bool TestShellDelegate::CanLockScreen() const {
return user_logged_in_ && can_lock_screen_;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 986a3ab..36fe97b 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -20,11 +20,11 @@ class TestShellDelegate : public ShellDelegate {
virtual ~TestShellDelegate();
// Overridden from ShellDelegate:
- virtual bool IsUserLoggedIn() OVERRIDE;
- virtual bool IsSessionStarted() OVERRIDE;
- virtual bool IsFirstRunAfterBoot() OVERRIDE;
+ virtual bool IsUserLoggedIn() const OVERRIDE;
+ virtual bool IsSessionStarted() const OVERRIDE;
+ virtual bool IsFirstRunAfterBoot() const OVERRIDE;
+ virtual bool CanLockScreen() const OVERRIDE;
virtual void LockScreen() OVERRIDE;
- virtual bool CanLockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
virtual bool IsScreenLocked() const OVERRIDE;
virtual void Shutdown() OVERRIDE;
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index 09a3a60..6a00729 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -733,6 +733,9 @@ Press any key to continue exploring.
<message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for virtual keyboard.">
Enable virtual keyboard
</message>
+ <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SHOULD_ALWAYS_SHOW_MENU" desc="In the settings tab, the text next to the checkbox to show the accessibility tray menu regardless of the state of a11y features.">
+ Enable accessibility menu
+ </message>
<message name="IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_BUTTON_LABEL" desc="Label for the button opening display settings tab.">
Display settings
</message>
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 78a1660..441ff7a 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -112,6 +112,12 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) {
if (prefs->FindPreference(prefs::kMagnifierType) == NULL) {
prefs->RegisterStringPref(prefs::kMagnifierType,
"",
+ PrefService::SYNCABLE_PREF);
+ }
+ if (prefs->FindPreference(prefs::kShouldAlwaysShowAccessibilityMenu) ==
+ NULL) {
+ prefs->RegisterBooleanPref(prefs::kShouldAlwaysShowAccessibilityMenu,
+ "",
PrefService::UNSYNCABLE_PREF);
}
if (prefs->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) {
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 262cf9b..a5a7131 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -782,6 +782,10 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
prefs::kMagnifierType,
base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
base::Unretained(this)));
+ pref_registrar_->Add(
+ prefs::kShouldAlwaysShowAccessibilityMenu,
+ base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
+ base::Unretained(this)));
UpdateClockType();
UpdateShowLogoutButtonInTray();
diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html
index 89d62ec..dc3026b 100644
--- a/chrome/browser/resources/options/browser_options.html
+++ b/chrome/browser/resources/options/browser_options.html
@@ -608,6 +608,15 @@
<div class="option-name">
<div class="checkbox">
<label>
+ <input id="accessibility-should-always-show-menu"
+ pref="settings.a11y.enable_menu" type="checkbox">
+ <span i18n-content="accessibilityAlwaysShowMenu"></span>
+ </label>
+ </div>
+ </div>
+ <div class="option-name">
+ <div class="checkbox">
+ <label>
<input id="accessibility-spoken-feedback-check" type="checkbox">
<span i18n-content="accessibilitySpokenFeedback"></span>
</label>
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 3bede4b..7e3e321 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -100,7 +100,7 @@ ChromeShellDelegate::~ChromeShellDelegate() {
instance_ = NULL;
}
-bool ChromeShellDelegate::IsUserLoggedIn() {
+bool ChromeShellDelegate::IsUserLoggedIn() const {
#if defined(OS_CHROMEOS)
// When running a Chrome OS build outside of a device (i.e. on a developer's
// workstation) and not running as login-manager, pretend like we're always
@@ -117,7 +117,7 @@ bool ChromeShellDelegate::IsUserLoggedIn() {
}
// Returns true if we're logged in and browser has been started
-bool ChromeShellDelegate::IsSessionStarted() {
+bool ChromeShellDelegate::IsSessionStarted() const {
#if defined(OS_CHROMEOS)
return chromeos::UserManager::Get()->IsSessionStarted();
#else
@@ -125,7 +125,7 @@ bool ChromeShellDelegate::IsSessionStarted() {
#endif
}
-bool ChromeShellDelegate::IsFirstRunAfterBoot() {
+bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
#if defined(OS_CHROMEOS)
return CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot);
#else
@@ -133,7 +133,7 @@ bool ChromeShellDelegate::IsFirstRunAfterBoot() {
#endif
}
-bool ChromeShellDelegate::CanLockScreen() {
+bool ChromeShellDelegate::CanLockScreen() const {
#if defined(OS_CHROMEOS)
return chromeos::UserManager::Get()->CanCurrentUserLock();
#else
@@ -372,8 +372,16 @@ void ChromeShellDelegate::SetMagnifier(ash::MagnifierType type) {
bool ChromeShellDelegate::ShouldAlwaysShowAccessibilityMenu() const {
#if defined(OS_CHROMEOS)
- // TODO(yoshiki): Add the checkbox on chrome://settings. crbug.com/158287
- return false;
+ if (!IsUserLoggedIn())
+ return true;
+
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ if (!profile)
+ return false;
+
+ PrefService* user_pref_service = profile->GetPrefs();
+ return user_pref_service &&
+ user_pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu);
#else
return false;
#endif
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h
index 79bd312..568009f 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -36,10 +36,10 @@ class ChromeShellDelegate : public ash::ShellDelegate,
}
// ash::ShellDelegate overrides;
- virtual bool IsUserLoggedIn() OVERRIDE;
- virtual bool IsSessionStarted() OVERRIDE;
- virtual bool IsFirstRunAfterBoot() OVERRIDE;
- virtual bool CanLockScreen() OVERRIDE;
+ virtual bool IsUserLoggedIn() const OVERRIDE;
+ virtual bool IsSessionStarted() const OVERRIDE;
+ virtual bool IsFirstRunAfterBoot() const OVERRIDE;
+ virtual bool CanLockScreen() const OVERRIDE;
virtual void LockScreen() OVERRIDE;
virtual void UnlockScreen() OVERRIDE;
virtual bool IsScreenLocked() const OVERRIDE;
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index adff348..104644f 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -300,6 +300,8 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY },
{ "accessibilityVirtualKeyboard",
IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION },
+ { "accessibilityAlwaysShowMenu",
+ IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SHOULD_ALWAYS_SHOW_MENU },
{ "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING },
{ "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET },
{ "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON },
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 9b8d6b5..5b232fa 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -741,6 +741,9 @@ const char kMagnifierType[] = "settings.a11y.screen_magnifier_type";
// A boolean pref which determines whether virtual keyboard is enabled.
// TODO(hashimoto): Remove this pref.
const char kVirtualKeyboardEnabled[] = "settings.a11y.virtual_keyboard";
+// A boolean pref which determines whether the accessibility menu shows
+// regardless of the state of a11y features.
+const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu";
// A boolean pref which turns on Advanced Filesystem
// (USB support, SD card, etc).
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index fe6aecb..d713440 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -270,6 +270,7 @@ extern const char kHighContrastEnabled[];
extern const char kScreenMagnifierScale[];
extern const char kMagnifierType[];
extern const char kVirtualKeyboardEnabled[];
+extern const char kShouldAlwaysShowAccessibilityMenu[];
extern const char kLabsAdvancedFilesystemEnabled[];
extern const char kLabsMediaplayerEnabled[];
extern const char kEnableScreenLock[];