summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 14:30:12 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 14:30:12 +0000
commitdb63363fc9fedd78e24df0d2db98d5afb5174e7b (patch)
tree05914ec57d83bf9c4bfbdd9944f17f36d7f00698
parent95b42e2745a2380a16112a059bd0e842d81f0c0a (diff)
downloadchromium_src-db63363fc9fedd78e24df0d2db98d5afb5174e7b.zip
chromium_src-db63363fc9fedd78e24df0d2db98d5afb5174e7b.tar.gz
chromium_src-db63363fc9fedd78e24df0d2db98d5afb5174e7b.tar.bz2
A11y: Introduce High Contrast Mode and Screen Magnifier to ubar tray.
This patch add a sub-menu to set accessibility feature (spoken feedback, high-contrast and screen magnifier) under accessibility menu. The design is at http://crbug.com/158281. BUG=160689, 158307 TEST=manual TBR=nkostylev@chromium.org, jhawkins@chromium.org # TBRing for just rename changes. Review URL: https://codereview.chromium.org/11415025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170180 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/ash.gyp1
-rw-r--r--ash/ash_strings.grd23
-rw-r--r--ash/magnifier/magnifier_constants.h18
-rw-r--r--ash/shell/shell_delegate_impl.cc24
-rw-r--r--ash/shell/shell_delegate_impl.h7
-rw-r--r--ash/shell_delegate.h20
-rw-r--r--ash/system/chromeos/network/network_list_detailed_view_base.cc7
-rw-r--r--ash/system/tray/system_tray_delegate.h3
-rw-r--r--ash/system/tray/system_tray_notifier.cc5
-rw-r--r--ash/system/tray/system_tray_notifier.h2
-rw-r--r--ash/system/tray/test_system_tray_delegate.cc3
-rw-r--r--ash/system/tray/test_system_tray_delegate.h1
-rw-r--r--ash/system/tray/tray_constants.cc3
-rw-r--r--ash/system/tray/tray_constants.h3
-rw-r--r--ash/system/tray_accessibility.cc280
-rw-r--r--ash/system/tray_accessibility.h15
-rw-r--r--ash/test/test_shell_delegate.cc22
-rw-r--r--ash/test/test_shell_delegate.h7
-rw-r--r--chrome/browser/chromeos/accessibility/accessibility_util.cc33
-rw-r--r--chrome/browser/chromeos/accessibility/accessibility_util.h40
-rw-r--r--chrome/browser/chromeos/accessibility/magnification_manager.cc36
-rw-r--r--chrome/browser/chromeos/accessibility/magnification_manager.h4
-rw-r--r--chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc38
-rw-r--r--chrome/browser/chromeos/preferences.cc6
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc29
-rw-r--r--chrome/browser/resources/options/browser_options.js4
-rw-r--r--chrome/browser/ui/ash/ash_init.cc8
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.cc39
-rw-r--r--chrome/browser/ui/ash/chrome_shell_delegate.h7
-rw-r--r--chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc11
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc6
-rw-r--r--chrome/common/pref_names.cc2
-rw-r--r--chrome/common/pref_names.h2
-rw-r--r--chrome/common/url_constants.cc5
-rw-r--r--chrome/common/url_constants.h5
35 files changed, 558 insertions, 161 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 53cf01c..ec0473f 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -135,6 +135,7 @@
'launcher/tabbed_launcher_button.h',
'magnifier/magnification_controller.cc',
'magnifier/magnification_controller.h',
+ 'magnifier/magnifier_constants.h',
'magnifier/partial_magnification_controller.cc',
'magnifier/partial_magnification_controller.h',
'root_window_controller.cc',
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd
index c58cc09..b2eb682 100644
--- a/ash/ash_strings.grd
+++ b/ash/ash_strings.grd
@@ -404,8 +404,27 @@ Press Shift + Alt to switch.
Your input method has changed to <ph name="INPUT_METHOD_ID">$1<ex>EN</ex></ph>*(<ph name="BEGIN_LINK">&lt;a target="_blank" href="$2"&gt;</ph>3rd party<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph>).
Press Shift + Alt to switch.
</message>
- <message name="IDS_ASH_STATUS_TRAY_DISABLE_SPOKEN_FEEDBACK" desc="The label used in the tray popup to disable spoken feedback.">
- Disable spoken feedback
+ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY" desc="The label used in the tray menu to show the accessibility option menu.">
+ Accessibility options
+ </message>
+ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE" desc="The label used in the title of the accessibility option menu.">
+ Accessibility
+ </message>
+ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK" desc="The label used in the accessibility menu of the
+ system tray to toggle on/off spoken feedback feature.">
+ Spoken feedback
+ </message>
+ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE" desc="The label used in the accessibility menu of t
+ he system tray to toggle on/off high contrast mode feature.">
+ High contrast mode
+ </message>
+ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER" desc="The label used in the accessibility menu of the
+ system tray to toggle on/off magnifier feature.">
+ Screen magnifier
+ </message>
+ <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LEARN_MORE" desc="The label used in the accessibility menu of the system tray
+ to open a webpage (article on help center) containing explanation about accessibility feature.">
+ Learn more...
</message>
<message name="IDS_ASH_STATUS_TRAY_BATTERY_FULL" desc="The label in the tray dialog to indicate that the battery is full.">
Battery full
diff --git a/ash/magnifier/magnifier_constants.h b/ash/magnifier/magnifier_constants.h
new file mode 100644
index 0000000..4ca4c89
--- /dev/null
+++ b/ash/magnifier/magnifier_constants.h
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_MAGNIFIER_MAGNIFIER_CONSTANTS_H_
+#define ASH_MAGNIFIER_MAGNIFIER_CONSTANTS_H_
+
+namespace ash {
+
+enum MagnifierType {
+ MAGNIFIER_OFF,
+ MAGNIFIER_FULL,
+ MAGNIFIER_PARTIAL,
+};
+
+} // namespace ash
+
+#endif // ASH_MAGNIFIER_MAGNIFIER_CONSTANTS_H_
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index b62bbc3..1d569c8 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -22,7 +22,9 @@ ShellDelegateImpl::ShellDelegateImpl()
: watcher_(NULL),
launcher_delegate_(NULL),
locked_(false),
- spoken_feedback_enabled_(false) {
+ spoken_feedback_enabled_(false),
+ high_contrast_enabled_(false),
+ screen_magnifier_type_(MAGNIFIER_OFF) {
}
ShellDelegateImpl::~ShellDelegateImpl() {
@@ -122,6 +124,26 @@ bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const {
return spoken_feedback_enabled_;
}
+void ShellDelegateImpl::ToggleHighContrast() {
+ high_contrast_enabled_ = !high_contrast_enabled_;
+}
+
+bool ShellDelegateImpl::IsHighContrastEnabled() const {
+ return high_contrast_enabled_;
+}
+
+void ShellDelegateImpl::SetMagnifier(MagnifierType type) {
+ screen_magnifier_type_ = type;
+}
+
+MagnifierType ShellDelegateImpl::GetMagnifierType() const {
+ return screen_magnifier_type_;
+}
+
+bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const {
+ return false;
+}
+
app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
return ash::shell::CreateAppListViewDelegate();
}
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 91f413ec..555e87f 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -43,6 +43,11 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE;
virtual void ToggleSpokenFeedback() OVERRIDE;
virtual bool IsSpokenFeedbackEnabled() const OVERRIDE;
+ virtual void ToggleHighContrast() OVERRIDE;
+ virtual bool IsHighContrastEnabled() const OVERRIDE;
+ virtual void SetMagnifier(MagnifierType type) OVERRIDE;
+ virtual MagnifierType GetMagnifierType() const OVERRIDE;
+ virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE;
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
virtual ash::LauncherDelegate* CreateLauncherDelegate(
ash::LauncherModel* model) OVERRIDE;
@@ -72,6 +77,8 @@ class ShellDelegateImpl : public ash::ShellDelegate {
bool locked_;
bool spoken_feedback_enabled_;
+ bool high_contrast_enabled_;
+ MagnifierType screen_magnifier_type_;
DISALLOW_COPY_AND_ASSIGN(ShellDelegateImpl);
};
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index 7a94be4..2b067d745 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -8,6 +8,7 @@
#include <vector>
#include "ash/ash_export.h"
+#include "ash/magnifier/magnifier_constants.h"
#include "ash/shell.h"
#include "base/callback.h"
#include "base/string16.h"
@@ -129,13 +130,28 @@ class ASH_EXPORT ShellDelegate {
// Get the current browser context. This will get us the current profile.
virtual content::BrowserContext* GetCurrentBrowserContext() = 0;
- // Invoked when the user presses a shortcut to toggle spoken feedback
- // for accessibility.
+ // Invoked to toggle spoken feedback for accessibility
virtual void ToggleSpokenFeedback() = 0;
// Returns true if spoken feedback is enabled.
virtual bool IsSpokenFeedbackEnabled() const = 0;
+ // Invoked to toggle high contrast for accessibility.
+ virtual void ToggleHighContrast() = 0;
+
+ // Returns true if high contrast mode is enabled.
+ virtual bool IsHighContrastEnabled() const = 0;
+
+ // Invoked to change the mode of the screen magnifier.
+ virtual void SetMagnifier(MagnifierType type) = 0;
+
+ // Returns the current screen magnifier mode.
+ virtual MagnifierType GetMagnifierType() const = 0;
+
+ // Returns true if the user want to show accesibility menu even when all the
+ // accessibility features are disabled.
+ virtual bool ShouldAlwaysShowAccessibilityMenu() const = 0;
+
// Invoked to create an AppListViewDelegate. Shell takes the ownership of
// the created delegate.
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0;
diff --git a/ash/system/chromeos/network/network_list_detailed_view_base.cc b/ash/system/chromeos/network/network_list_detailed_view_base.cc
index 3bfa488..5362d0ff 100644
--- a/ash/system/chromeos/network/network_list_detailed_view_base.cc
+++ b/ash/system/chromeos/network/network_list_detailed_view_base.cc
@@ -23,7 +23,6 @@
#include "ui/views/widget/widget.h"
namespace {
-const int kPaddingAroundBottomRow = 5;
// Create a label with the font size and color used in the network info bubble.
views::Label* CreateInfoBubbleLabel(const string16& text) {
@@ -139,9 +138,9 @@ void NetworkListDetailedViewBase::AppendNetworkExtra() {
views::BoxLayout* layout = new
views::BoxLayout(views::BoxLayout::kHorizontal,
- kPaddingAroundBottomRow,
- kPaddingAroundBottomRow,
- -1);
+ kTrayMenuBottomRowPadding,
+ kTrayMenuBottomRowPadding,
+ kTrayMenuBottomRowPaddingBetweenItems);
layout->set_spread_blank_space(true);
views::View* bottom_row = new View();
bottom_row->SetLayoutManager(layout);
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index b8c7f3e..f0a504a 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -149,6 +149,9 @@ class SystemTrayDelegate {
// Shows settings related to input methods.
virtual void ShowIMESettings() = 0;
+ // Show accessilibity help.
+ virtual void ShowAccessibilityHelp() = 0;
+
// Shows help.
virtual void ShowHelp() = 0;
diff --git a/ash/system/tray/system_tray_notifier.cc b/ash/system/tray/system_tray_notifier.cc
index b11f256..17d6fd2 100644
--- a/ash/system/tray/system_tray_notifier.cc
+++ b/ash/system/tray/system_tray_notifier.cc
@@ -81,12 +81,11 @@ void SystemTrayNotifier::AddSmsObserver(SmsObserver* observer) {
}
#endif
-void SystemTrayNotifier::NotifyAccessibilityModeChanged(
- bool spoken_feedback_enabled) {
+void SystemTrayNotifier::NotifyAccessibilityModeChanged() {
FOR_EACH_OBSERVER(
AccessibilityObserver,
accessibility_observers_,
- OnAccessibilityModeChanged(spoken_feedback_enabled));
+ OnAccessibilityModeChanged());
}
void SystemTrayNotifier::NotifyVolumeChanged(float level) {
diff --git a/ash/system/tray/system_tray_notifier.h b/ash/system/tray/system_tray_notifier.h
index b149d27..9ef149d 100644
--- a/ash/system/tray/system_tray_notifier.h
+++ b/ash/system/tray/system_tray_notifier.h
@@ -57,7 +57,7 @@ public:
void AddSmsObserver(SmsObserver* observer);
#endif
- void NotifyAccessibilityModeChanged(bool spoken_feedback_enabled);
+ void NotifyAccessibilityModeChanged();
void NotifyVolumeChanged(float level);
void NotifyMuteToggled();
void NotifyRefreshBluetooth();
diff --git a/ash/system/tray/test_system_tray_delegate.cc b/ash/system/tray/test_system_tray_delegate.cc
index 8e0cc61..b72ff6d 100644
--- a/ash/system/tray/test_system_tray_delegate.cc
+++ b/ash/system/tray/test_system_tray_delegate.cc
@@ -131,6 +131,9 @@ void TestSystemTrayDelegate::ShowIMESettings() {
void TestSystemTrayDelegate::ShowHelp() {
}
+void TestSystemTrayDelegate::ShowAccessibilityHelp() {
+}
+
void TestSystemTrayDelegate::ShutDown() {
MessageLoop::current()->Quit();
}
diff --git a/ash/system/tray/test_system_tray_delegate.h b/ash/system/tray/test_system_tray_delegate.h
index a49b307..042d131 100644
--- a/ash/system/tray/test_system_tray_delegate.h
+++ b/ash/system/tray/test_system_tray_delegate.h
@@ -41,6 +41,7 @@ class TestSystemTrayDelegate : public SystemTrayDelegate {
virtual void ShowDriveSettings() OVERRIDE;
virtual void ShowIMESettings() OVERRIDE;
virtual void ShowHelp() OVERRIDE;
+ virtual void ShowAccessibilityHelp() OVERRIDE;
virtual void ShutDown() OVERRIDE;
virtual void SignOut() OVERRIDE;
virtual void RequestLockScreen() OVERRIDE;
diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc
index b9e6863..583a488 100644
--- a/ash/system/tray/tray_constants.cc
+++ b/ash/system/tray/tray_constants.cc
@@ -21,6 +21,9 @@ const int kTrayImageItemVerticalPaddingVerticalAlignment = 1;
const int kTrayLabelItemHorizontalPaddingBottomAlignment = 7;
const int kTrayLabelItemVerticalPaddingVeriticalAlignment = 4;
+const int kTrayMenuBottomRowPadding = 5;
+const int kTrayMenuBottomRowPaddingBetweenItems = -1;
+
const int kTrayPopupAutoCloseDelayInSeconds = 2;
const int kTrayPopupAutoCloseDelayForTextInSeconds = 5;
const int kTrayPopupPaddingHorizontal = 18;
diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h
index a251f18..f026239 100644
--- a/ash/system/tray/tray_constants.h
+++ b/ash/system/tray/tray_constants.h
@@ -22,6 +22,9 @@ extern const int kTrayImageItemVerticalPaddingVerticalAlignment;
extern const int kTrayLabelItemHorizontalPaddingBottomAlignment;
extern const int kTrayLabelItemVerticalPaddingVeriticalAlignment;
+extern const int kTrayMenuBottomRowPadding;
+extern const int kTrayMenuBottomRowPaddingBetweenItems;
+
extern const int kTrayPopupAutoCloseDelayInSeconds;
extern const int kTrayPopupAutoCloseDelayForTextInSeconds;
extern const int kTrayPopupPaddingHorizontal;
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc
index 7ea654d5..5474e4e 100644
--- a/ash/system/tray_accessibility.cc
+++ b/ash/system/tray_accessibility.cc
@@ -6,10 +6,16 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
+#include "ash/system/tray/system_tray.h"
+#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_constants.h"
+#include "ash/system/tray/tray_details_view.h"
+#include "ash/system/tray/tray_item_more.h"
+#include "ash/system/tray/tray_notification_view.h"
#include "ash/system/tray/tray_views.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
#include "ui/views/controls/image_view.h"
@@ -20,82 +26,254 @@
namespace ash {
namespace internal {
-class DefaultAccessibilityView : public ActionableView {
- public:
- DefaultAccessibilityView() {
- SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
- kTrayPopupPaddingHorizontal,
- 0,
- kTrayPopupPaddingBetweenItems));
+namespace {
+const int kPaddingAroundBottomRow = 5;
+
+bool IsAnyAccessibilityFeatureEnabled() {
+ ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
+ return shell_delegate &&
+ (shell_delegate->IsSpokenFeedbackEnabled() ||
+ shell_delegate->IsHighContrastEnabled() ||
+ shell_delegate->GetMagnifierType() != ash::MAGNIFIER_OFF);
+}
+
+user::LoginStatus GetCurrentLoginStatus() {
+ return Shell::GetInstance()->tray_delegate()->GetUserLoginStatus();
+}
+} // namespace
+
+namespace tray {
+
+class DefaultAccessibilityView : public TrayItemMore {
+ public:
+ explicit DefaultAccessibilityView(SystemTrayItem* owner)
+ : TrayItemMore(owner, true) {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- FixedSizedImageView* image =
- new FixedSizedImageView(0, kTrayPopupItemHeight);
- image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK).
+ SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK).
ToImageSkia());
-
- AddChildView(image);
string16 label = bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_DISABLE_SPOKEN_FEEDBACK);
- AddChildView(new views::Label(label));
+ IDS_ASH_STATUS_TRAY_ACCESSIBILITY);
+ SetLabel(label);
SetAccessibleName(label);
}
- virtual ~DefaultAccessibilityView() {}
+ virtual ~DefaultAccessibilityView() {
+ }
- protected:
- // Overridden from ActionableView.
- virtual bool PerformAction(const ui::Event& event) OVERRIDE {
- if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
- Shell::GetInstance()->delegate()->ToggleSpokenFeedback();
- GetWidget()->Close();
- return true;
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView);
+};
+
+class AccessibilityDetailedView : public TrayDetailsView,
+ public ViewClickListener,
+ public views::ButtonListener,
+ public ShellObserver {
+ public:
+ explicit AccessibilityDetailedView(SystemTrayItem* owner,
+ user::LoginStatus login) :
+ TrayDetailsView(owner),
+ spoken_feedback_view_(NULL),
+ high_contrast_view_(NULL),
+ screen_magnifier_view_(NULL),
+ help_view_(NULL),
+ login_(login) {
+
+ Reset();
+
+ AppendAccessibilityList();
+ AppendHelpEntries();
+ CreateSpecialRow(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TITLE, this);
+
+ Layout();
+ }
+
+ virtual ~AccessibilityDetailedView() {
}
private:
+ // Add the accessibility feature list.
+ void AppendAccessibilityList() {
+ CreateScrollableList();
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityView);
+ ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
+ bool spoken_feedback_enabled = shell_delegate->IsSpokenFeedbackEnabled();
+ spoken_feedback_view_ = AddScrollListItem(
+ bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SPOKEN_FEEDBACK),
+ spoken_feedback_enabled ? gfx::Font::BOLD : gfx::Font::NORMAL,
+ spoken_feedback_enabled);
+ bool high_contrast_mode_enabled = shell_delegate->IsHighContrastEnabled();
+ high_contrast_view_ = AddScrollListItem(
+ bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE),
+ high_contrast_mode_enabled ? gfx::Font::BOLD : gfx::Font::NORMAL,
+ high_contrast_mode_enabled);
+ bool screen_magnifier_enabled =
+ shell_delegate->GetMagnifierType() == ash::MAGNIFIER_FULL;
+ screen_magnifier_view_ = AddScrollListItem(
+ bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER),
+ screen_magnifier_enabled ? gfx::Font::BOLD : gfx::Font::NORMAL,
+ screen_magnifier_enabled);
+ }
+
+ // Add help entries.
+ void AppendHelpEntries() {
+ // Currently the help page requires a browser window.
+ // TODO(yoshiki): show this even on login/lock screen. crbug.com/158286
+ if (login_ == user::LOGGED_IN_NONE ||
+ login_ == user::LOGGED_IN_LOCKED)
+ return;
+
+ views::View* bottom_row = new View();
+ views::BoxLayout* layout = new
+ views::BoxLayout(views::BoxLayout::kHorizontal,
+ kTrayMenuBottomRowPadding,
+ kTrayMenuBottomRowPadding,
+ kTrayMenuBottomRowPaddingBetweenItems);
+ layout->set_spread_blank_space(true);
+ bottom_row->SetLayoutManager(layout);
+
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+
+ TrayPopupLabelButton* help = new TrayPopupLabelButton(
+ this,
+ bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_ACCESSIBILITY_LEARN_MORE));
+ bottom_row->AddChildView(help);
+ help_view_ = help;
+
+ // TODO(yoshiki): Add "Customize accessibility" button when the customize is
+ // available. crbug.com/158281
+
+ AddChildView(bottom_row);
+ }
+
+ HoverHighlightView* AddScrollListItem(const string16& text,
+ gfx::Font::FontStyle style,
+ bool checked) {
+ HoverHighlightView* container = new HoverHighlightView(this);
+ container->set_fixed_height(kTrayPopupItemHeight);
+ container->AddCheckableLabel(text, style, checked);
+ scroll_content()->AddChildView(container);
+ return container;
+ }
+
+ // Overridden from ViewClickListener.
+ virtual void ClickedOn(views::View* sender) OVERRIDE {
+ ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
+ if (sender == footer()->content()) {
+ owner()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
+ } else if (sender == spoken_feedback_view_) {
+ shell_delegate->ToggleSpokenFeedback();
+ } else if (sender == high_contrast_view_) {
+ shell_delegate->ToggleHighContrast();
+ } else if (sender == screen_magnifier_view_) {
+ bool screen_magnifier_enabled =
+ shell_delegate->GetMagnifierType() == ash::MAGNIFIER_FULL;
+ shell_delegate->SetMagnifier(
+ screen_magnifier_enabled ? ash::MAGNIFIER_OFF : ash::MAGNIFIER_FULL);
+ }
+ }
+
+ // Overridden from ButtonListener.
+ virtual void ButtonPressed(views::Button* sender,
+ const ui::Event& event) OVERRIDE {
+ SystemTrayDelegate* tray_delegate = Shell::GetInstance()->tray_delegate();
+ if (sender == help_view_)
+ tray_delegate->ShowAccessibilityHelp();
+ }
+
+ views::View* spoken_feedback_view_;
+ views::View* high_contrast_view_;
+ views::View* screen_magnifier_view_;;
+ views::View* help_view_;
+ user::LoginStatus login_;
+
+ DISALLOW_COPY_AND_ASSIGN(AccessibilityDetailedView);
};
+class AccessibilityPopupView : public TrayNotificationView {
+ public:
+ AccessibilityPopupView(SystemTrayItem* owner)
+ : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK) {
+ InitView(GetLabel());
+ }
+
+ private:
+ views::Label* GetLabel() {
+ views::Label* label = new views::Label(
+ l10n_util::GetStringUTF16(
+ IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TURNED_ON_BUBBLE));
+ label->SetMultiLine(true);
+ label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ return label;
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView);
+};
+
+} // namespace tray
+
+
TrayAccessibility::TrayAccessibility(SystemTray* system_tray)
: TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_ACCESSIBILITY),
default_(NULL),
- detailed_(NULL) {
+ detailed_(NULL),
+ request_popup_view_(false),
+ accessibility_previously_enabled_(IsAnyAccessibilityFeatureEnabled()),
+ login_(GetCurrentLoginStatus()) {
+ DCHECK(Shell::GetInstance()->delegate());
+ DCHECK(system_tray);
+
+ Shell::GetInstance()->AddShellObserver(this);
}
-TrayAccessibility::~TrayAccessibility() {}
+TrayAccessibility::~TrayAccessibility() {
+ Shell::GetInstance()->RemoveShellObserver(this);
+}
bool TrayAccessibility::GetInitialVisibility() {
- return Shell::GetInstance()->delegate() &&
- Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled();
+ ShellDelegate* delegate = Shell::GetInstance()->delegate();
+ // Always shows this on the login screen.
+ if (login_ == user::LOGGED_IN_NONE)
+ return true;
+
+ if (delegate->ShouldAlwaysShowAccessibilityMenu() ||
+ IsAnyAccessibilityFeatureEnabled()) {
+ return true;
+ }
+
+ return false;
}
views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) {
- if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
+ CHECK(default_ == NULL);
+
+ login_ = status;
+
+ if (!GetInitialVisibility())
return NULL;
CHECK(default_ == NULL);
- default_ = new DefaultAccessibilityView();
+ default_ = new tray::DefaultAccessibilityView(this);
return default_;
}
views::View* TrayAccessibility::CreateDetailedView(user::LoginStatus status) {
CHECK(detailed_ == NULL);
- detailed_ = new views::View;
-
- detailed_->SetLayoutManager(new
- views::BoxLayout(views::BoxLayout::kHorizontal,
- kTrayPopupPaddingHorizontal, 10, kTrayPopupPaddingBetweenItems));
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- views::ImageView* image = new views::ImageView;
- image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK).
- ToImageSkia());
+ login_ = status;
- detailed_->AddChildView(image);
- detailed_->AddChildView(new views::Label(bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_ACCESSIBILITY_TURNED_ON_BUBBLE)));
+ if (request_popup_view_) {
+ detailed_ = new tray::AccessibilityPopupView(this);
+ request_popup_view_ = false;
+ } else {
+ detailed_ = new tray::AccessibilityDetailedView(this, status);
+ }
return detailed_;
}
@@ -108,15 +286,29 @@ void TrayAccessibility::DestroyDetailedView() {
detailed_ = NULL;
}
-void TrayAccessibility::OnAccessibilityModeChanged(bool enabled) {
+void TrayAccessibility::OnLoginStateChanged(user::LoginStatus status) {
+ login_ = status;
+
+ if (tray_view())
+ tray_view()->SetVisible(GetInitialVisibility());
+}
+
+void TrayAccessibility::OnAccessibilityModeChanged() {
if (tray_view())
- tray_view()->SetVisible(enabled);
+ tray_view()->SetVisible(GetInitialVisibility());
- if (enabled) {
+ bool accessibility_enabled = IsAnyAccessibilityFeatureEnabled();
+ if (!accessibility_previously_enabled_ && accessibility_enabled &&
+ login_ != user::LOGGED_IN_NONE) {
+ // Shows popup if the accessibilty status is being changed to true from
+ // false.
+ request_popup_view_ = true;
PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false);
} else if (detailed_) {
detailed_->GetWidget()->Close();
}
+
+ accessibility_previously_enabled_ = accessibility_enabled;
}
} // namespace internal
diff --git a/ash/system/tray_accessibility.h b/ash/system/tray_accessibility.h
index 69caffd..1ee1aab 100644
--- a/ash/system/tray_accessibility.h
+++ b/ash/system/tray_accessibility.h
@@ -5,6 +5,7 @@
#ifndef ASH_SYSTEM_TRAY_ACCESSIBILITY_H_
#define ASH_SYSTEM_TRAY_ACCESSIBILITY_H_
+#include "ash/shell_observer.h"
#include "ash/system/tray/tray_image_item.h"
namespace views {
@@ -19,13 +20,14 @@ class ASH_EXPORT AccessibilityObserver {
virtual ~AccessibilityObserver() {}
// Notifies when accessibilty mode changes.
- virtual void OnAccessibilityModeChanged(bool enabled) = 0;
+ virtual void OnAccessibilityModeChanged() = 0;
};
namespace internal {
class TrayAccessibility : public TrayImageItem,
- public AccessibilityObserver {
+ public AccessibilityObserver,
+ public ShellObserver {
public:
explicit TrayAccessibility(SystemTray* system_tray);
virtual ~TrayAccessibility();
@@ -39,11 +41,18 @@ class TrayAccessibility : public TrayImageItem,
virtual void DestroyDetailedView() OVERRIDE;
// Overridden from AccessibilityObserver.
- virtual void OnAccessibilityModeChanged(bool enabled) OVERRIDE;
+ virtual void OnAccessibilityModeChanged() OVERRIDE;
+
+ // Overriden from ShellObserver.
+ virtual void OnLoginStateChanged(user::LoginStatus status) OVERRIDE;
views::View* default_;
views::View* detailed_;
+ bool request_popup_view_;
+ bool accessibility_previously_enabled_;
+ user::LoginStatus login_;
+
DISALLOW_COPY_AND_ASSIGN(TrayAccessibility);
};
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 5047bfb7..e3aac46 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -22,6 +22,8 @@ TestShellDelegate::TestShellDelegate()
: locked_(false),
session_started_(true),
spoken_feedback_enabled_(false),
+ high_contrast_enabled_(false),
+ screen_magnifier_type_(MAGNIFIER_OFF),
user_logged_in_(true),
can_lock_screen_(true),
is_search_key_acting_as_function_key_(false),
@@ -113,6 +115,26 @@ bool TestShellDelegate::IsSpokenFeedbackEnabled() const {
return spoken_feedback_enabled_;
}
+void TestShellDelegate::ToggleHighContrast() {
+ high_contrast_enabled_ = !high_contrast_enabled_;
+}
+
+bool TestShellDelegate::IsHighContrastEnabled() const {
+ return high_contrast_enabled_;
+}
+
+void TestShellDelegate::SetMagnifier(const MagnifierType type) {
+ screen_magnifier_type_ = type;
+}
+
+MagnifierType TestShellDelegate::GetMagnifierType() const {
+ return screen_magnifier_type_;
+}
+
+bool TestShellDelegate::ShouldAlwaysShowAccessibilityMenu() const {
+ return false;
+}
+
app_list::AppListViewDelegate* TestShellDelegate::CreateAppListViewDelegate() {
return NULL;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 3c960fe..986a3ab 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -42,6 +42,11 @@ class TestShellDelegate : public ShellDelegate {
virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE;
virtual void ToggleSpokenFeedback() OVERRIDE;
virtual bool IsSpokenFeedbackEnabled() const OVERRIDE;
+ virtual void ToggleHighContrast() OVERRIDE;
+ virtual bool IsHighContrastEnabled() const OVERRIDE;
+ virtual void SetMagnifier(MagnifierType type) OVERRIDE;
+ virtual MagnifierType GetMagnifierType() const OVERRIDE;
+ virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE;
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
virtual LauncherDelegate* CreateLauncherDelegate(
ash::LauncherModel* model) OVERRIDE;
@@ -90,6 +95,8 @@ class TestShellDelegate : public ShellDelegate {
bool locked_;
bool session_started_;
bool spoken_feedback_enabled_;
+ bool high_contrast_enabled_;
+ MagnifierType screen_magnifier_type_;
bool user_logged_in_;
bool can_lock_screen_;
bool is_search_key_acting_as_function_key_;
diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.cc b/chrome/browser/chromeos/accessibility/accessibility_util.cc
index 722985d..2509ebd 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_util.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_util.cc
@@ -23,15 +23,18 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/speech/extension_api/tts_extension_api_controller.h"
+#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/user_script.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
+#include "googleurl/src/gurl.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -190,9 +193,9 @@ void EnableHighContrast(bool enabled) {
#endif
}
-void SetScreenMagnifier(ScreenMagnifierType type) {
+void SetMagnifier(ash::MagnifierType type) {
if (MagnificationManager::GetInstance())
- MagnificationManager::GetInstance()->SetScreenMagnifier(type);
+ MagnificationManager::GetInstance()->SetMagnifier(type);
}
void EnableVirtualKeyboard(bool enabled) {
@@ -244,28 +247,28 @@ bool IsHighContrastEnabled() {
return high_contrast_enabled;
}
-ScreenMagnifierType GetScreenMagnifierType() {
+ash::MagnifierType GetMagnifierType() {
if (!MagnificationManager::GetInstance())
- return MAGNIFIER_OFF;
- return MagnificationManager::GetInstance()->GetScreenMagnifierType();
+ return ash::MAGNIFIER_OFF;
+ return MagnificationManager::GetInstance()->GetMagnifierType();
}
-ScreenMagnifierType ScreenMagnifierTypeFromName(const char type_name[]) {
+ash::MagnifierType MagnifierTypeFromName(const char type_name[]) {
if (0 == strcmp(type_name, kScreenMagnifierFull))
- return MAGNIFIER_FULL;
+ return ash::MAGNIFIER_FULL;
else if (0 == strcmp(type_name, kScreenMagnifierPartial))
- return MAGNIFIER_PARTIAL;
+ return ash::MAGNIFIER_PARTIAL;
else
- return MAGNIFIER_OFF;
+ return ash::MAGNIFIER_OFF;
}
-const char* ScreenMagnifierNameFromType(ScreenMagnifierType type) {
+const char* ScreenMagnifierNameFromType(ash::MagnifierType type) {
switch (type) {
- case MAGNIFIER_OFF:
+ case ash::MAGNIFIER_OFF:
return kScreenMagnifierOff;
- case MAGNIFIER_FULL:
+ case ash::MAGNIFIER_FULL:
return kScreenMagnifierFull;
- case MAGNIFIER_PARTIAL:
+ case ash::MAGNIFIER_PARTIAL:
return kScreenMagnifierPartial;
}
return kScreenMagnifierOff;
@@ -276,5 +279,9 @@ void MaybeSpeak(const std::string& utterance) {
Speak(utterance);
}
+void ShowAccessibilityHelp(Browser* browser) {
+ chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL));
+}
+
} // namespace accessibility
} // namespace chromeos
diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.h b/chrome/browser/chromeos/accessibility/accessibility_util.h
index ea5f0217..c264dbc 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_util.h
+++ b/chrome/browser/chromeos/accessibility/accessibility_util.h
@@ -7,6 +7,10 @@
#include <string>
+#include "ash/magnifier/magnifier_constants.h"
+
+class Browser;
+
namespace content {
class WebUI;
}
@@ -14,30 +18,19 @@ class WebUI;
namespace chromeos {
namespace accessibility {
-// Enable or disable spoken feedback. Enabling spoken feedback installs the
+// Enables or disables spoken feedback. Enabling spoken feedback installs the
// ChromeVox component extension. If this is being called in a login/oobe
// login screen, pass the WebUI object in login_web_ui so that ChromeVox
// can be injected directly into that screen, otherwise it should be NULL.
void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui);
-// Enable or disable the high contrast mode for Chrome.
+// Enables or disables the high contrast mode for Chrome.
void EnableHighContrast(bool enabled);
-// String constants of the magnifier types.
-extern const char kScreenMagnifierOff[];
-extern const char kScreenMagnifierFull[];
-extern const char kScreenMagnifierPartial[];
-
-enum ScreenMagnifierType {
- MAGNIFIER_OFF,
- MAGNIFIER_FULL,
- MAGNIFIER_PARTIAL,
-};
+// Sets the type of screen magnifier, or disable it.
+void SetMagnifier(ash::MagnifierType type);
-// Set the type of screen magnifier, or disable it.
-void SetScreenMagnifier(ScreenMagnifierType type);
-
-// Enable or disable the virtual keyboard.
+// Enables or disable the virtual keyboard.
void EnableVirtualKeyboard(bool enabled);
// Toggles whether Chrome OS spoken feedback is on or off. See docs for
@@ -54,17 +47,20 @@ bool IsSpokenFeedbackEnabled();
bool IsHighContrastEnabled();
// Returns the current state of the screen magnifier.
-ScreenMagnifierType GetScreenMagnifierType();
+ash::MagnifierType GetMagnifierType();
-// Translates from a string to ScreenMagnifierType.
-ScreenMagnifierType ScreenMagnifierTypeFromName(const char type_name[]);
+// Translates from a string to MagnifierType.
+ash::MagnifierType MagnifierTypeFromName(const char type_name[]);
-// Translates from a ScreenMagnifierType to type string.
-const char* ScreenMagnifierNameFromType(ScreenMagnifierType type);
+// Translates from a MagnifierType to type string.
+const char* ScreenMagnifierNameFromType(ash::MagnifierType type);
-// Speak the given text if the accessibility pref is already set.
+// Speaks the given text if the accessibility pref is already set.
void MaybeSpeak(const std::string& utterance);
+// Shows the accessibility help tab on the browser.
+void ShowAccessibilityHelp(Browser* browser);
+
} // namespace accessibility
} // namespace chromeos
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager.cc b/chrome/browser/chromeos/accessibility/magnification_manager.cc
index 205a00f..56819a4 100644
--- a/chrome/browser/chromeos/accessibility/magnification_manager.cc
+++ b/chrome/browser/chromeos/accessibility/magnification_manager.cc
@@ -7,6 +7,7 @@
#include "ash/magnifier/magnification_controller.h"
#include "ash/magnifier/partial_magnification_controller.h"
#include "ash/shell.h"
+#include "ash/system/tray/system_tray_notifier.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "chrome/browser/api/prefs/pref_member.h"
@@ -50,32 +51,35 @@ class MagnificationManagerImpl : public MagnificationManager,
}
// MagnificationManager implimentation:
- accessibility::ScreenMagnifierType GetScreenMagnifierType() OVERRIDE {
+ ash::MagnifierType GetMagnifierType() OVERRIDE {
if (!profile_)
- return accessibility::MAGNIFIER_OFF;
+ return ash::MAGNIFIER_OFF;
PrefService* prefs = profile_->GetPrefs();
if (!prefs)
- return accessibility::MAGNIFIER_OFF;
+ return ash::MAGNIFIER_OFF;
- return accessibility::ScreenMagnifierTypeFromName(
- prefs->GetString(prefs::kScreenMagnifierType).c_str());
+ return accessibility::MagnifierTypeFromName(
+ prefs->GetString(prefs::kMagnifierType).c_str());
}
- void SetScreenMagnifier(accessibility::ScreenMagnifierType type) OVERRIDE {
+ void SetMagnifier(ash::MagnifierType type) OVERRIDE {
PrefService* prefs = profile_->GetPrefs();
if (prefs) {
- std::string typeString = ScreenMagnifierNameFromType(type);
- if (typeString != prefs->GetString(prefs::kScreenMagnifierType)) {
- prefs->SetString(prefs::kScreenMagnifierType, typeString);
+ std::string typeString = accessibility::ScreenMagnifierNameFromType(type);
+ if (typeString != prefs->GetString(prefs::kMagnifierType)) {
+ prefs->SetString(prefs::kMagnifierType, typeString);
prefs->CommitPendingWrite();
}
}
+ ash::Shell::GetInstance()->system_tray_notifier()->
+ NotifyAccessibilityModeChanged();
+
ash::Shell::GetInstance()->magnification_controller()->SetEnabled(
- type == accessibility::MAGNIFIER_FULL);
+ type == ash::MAGNIFIER_FULL);
ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
- type == accessibility::MAGNIFIER_PARTIAL);
+ type == ash::MAGNIFIER_PARTIAL);
}
private:
@@ -88,7 +92,7 @@ class MagnificationManagerImpl : public MagnificationManager,
pref_change_registrar_.reset(new PrefChangeRegistrar);
pref_change_registrar_->Init(profile->GetPrefs());
pref_change_registrar_->Add(
- prefs::kScreenMagnifierType,
+ prefs::kMagnifierType,
base::Bind(&MagnificationManagerImpl::UpdateMagnifierStatus,
base::Unretained(this)));
}
@@ -100,12 +104,12 @@ class MagnificationManagerImpl : public MagnificationManager,
void UpdateMagnifierStatus() {
UserManager* manager = UserManager::Get();
if (!profile_) {
- SetScreenMagnifier(accessibility::MAGNIFIER_OFF);
+ SetMagnifier(ash::MAGNIFIER_OFF);
} else if (manager && !manager->IsSessionStarted()) {
- SetScreenMagnifier(accessibility::MAGNIFIER_FULL);
+ SetMagnifier(ash::MAGNIFIER_FULL);
} else {
- accessibility::ScreenMagnifierType type = GetScreenMagnifierType();
- SetScreenMagnifier(type);
+ ash::MagnifierType type = GetMagnifierType();
+ SetMagnifier(type);
}
}
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager.h b/chrome/browser/chromeos/accessibility/magnification_manager.h
index 2b39a07..29529b5 100644
--- a/chrome/browser/chromeos/accessibility/magnification_manager.h
+++ b/chrome/browser/chromeos/accessibility/magnification_manager.h
@@ -29,9 +29,9 @@ class MagnificationManager {
virtual ~MagnificationManager() {}
// Returns the current type of the screen magnifier.
- virtual accessibility::ScreenMagnifierType GetScreenMagnifierType() = 0;
+ virtual ash::MagnifierType GetMagnifierType() = 0;
// Changes the type of the screen magnifier.
- virtual void SetScreenMagnifier(accessibility::ScreenMagnifierType type) = 0;
+ virtual void SetMagnifier(ash::MagnifierType type) = 0;
};
} // namespace chromeos
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
index 5f29f2f..bc619fc 100644
--- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
+++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
@@ -43,14 +43,14 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest {
return PrefServiceBase::FromBrowserContext(profile());
}
- void SetScreenManagnifierTypeToPref(accessibility::ScreenMagnifierType type) {
- prefs()->SetString(prefs::kScreenMagnifierType,
- ScreenMagnifierNameFromType(type));
+ void SetScreenManagnifierTypeToPref(ash::MagnifierType type) {
+ prefs()->SetString(prefs::kMagnifierType,
+ accessibility::ScreenMagnifierNameFromType(type));
}
- void CheckCurrentScreenMagnifierType(
- accessibility::ScreenMagnifierType type) {
- EXPECT_EQ(MagnificationManager::GetInstance()->GetScreenMagnifierType(),
+ void CheckCurrentMagnifierType(
+ ash::MagnifierType type) {
+ EXPECT_EQ(MagnificationManager::GetInstance()->GetMagnifierType(),
type);
}
@@ -59,20 +59,20 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, Login) {
// Confirms that magnifier is enabled on the login screen.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
// Logs in.
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
UserManager::Get()->SessionStarted();
// Confirms that magnifier is disabled just after login.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_OFF);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
// Enables magnifier.
- SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
// Confirms that magnifier is enabled.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, WorkingWithPref) {
@@ -81,25 +81,25 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, WorkingWithPref) {
UserManager::Get()->SessionStarted();
// Confirms that magnifier is disabled just after login.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_OFF);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
// Sets the pref as true to enable magnifier.
- SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
// Confirms that magnifier is enabled.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
// Sets the pref as false to disabled magnifier.
- SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_OFF);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
// Confirms that magnifier is disabled.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_OFF);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
// Sets the pref as true to enable magnifier again.
- SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
// Confirms that magnifier is enabled.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedPref) {
@@ -107,13 +107,13 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedPref) {
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
// Sets the pref as true to enable magnifier before login.
- SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
// Logs in.
UserManager::Get()->SessionStarted();
// Confirms that magnifier is enabled just after login.
- CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL);
+ CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index d1d25bb..78a1660 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -109,8 +109,8 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) {
std::numeric_limits<double>::min(),
PrefService::UNSYNCABLE_PREF);
}
- if (prefs->FindPreference(prefs::kScreenMagnifierType) == NULL) {
- prefs->RegisterStringPref(prefs::kScreenMagnifierType,
+ if (prefs->FindPreference(prefs::kMagnifierType) == NULL) {
+ prefs->RegisterStringPref(prefs::kMagnifierType,
"",
PrefService::UNSYNCABLE_PREF);
}
@@ -306,7 +306,7 @@ void Preferences::InitUserPrefs(PrefService* prefs) {
prefs, callback);
natural_scroll_.Init(prefs::kNaturalScroll, prefs, callback);
accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, callback);
- screen_magnifier_type_.Init(prefs::kScreenMagnifierType, prefs, callback);
+ screen_magnifier_type_.Init(prefs::kMagnifierType, prefs, callback);
screen_magnifier_scale_.Init(prefs::kScreenMagnifierScale, prefs, callback);
mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, callback);
touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, callback);
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 130631c..262cf9b 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -197,7 +197,6 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
registrar_.Add(this,
chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
content::NotificationService::AllSources());
-
}
virtual void Initialize() OVERRIDE {
@@ -219,10 +218,16 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
if (SystemKeyEventListener::GetInstance())
SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
- accessibility_enabled_.Init(
+ spoken_feedback_enabled_.Init(
prefs::kSpokenFeedbackEnabled,
g_browser_process->local_state(),
- base::Bind(&SystemTrayDelegate::OnSpokenFeedbackEnabledChanged,
+ base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
+ base::Unretained(this)));
+
+ high_contrast_enabled_.Init(
+ prefs::kHighContrastEnabled,
+ g_browser_process->local_state(),
+ base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
base::Unretained(this)));
network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT);
@@ -355,6 +360,10 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
chrome::ShowHelp(GetAppropriateBrowser(), chrome::HELP_SOURCE_MENU);
}
+ virtual void ShowAccessibilityHelp() OVERRIDE {
+ accessibility::ShowAccessibilityHelp(GetAppropriateBrowser());
+ }
+
virtual void ShutDown() OVERRIDE {
ash::Shell::GetInstance()->session_state_controller()->RequestShutdown();
}
@@ -769,6 +778,11 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
prefs::kShowLogoutButtonInTray,
base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray,
base::Unretained(this)));
+ pref_registrar_->Add(
+ prefs::kMagnifierType,
+ base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
+ base::Unretained(this)));
+
UpdateClockType();
UpdateShowLogoutButtonInTray();
search_key_mapped_to_ =
@@ -1095,10 +1109,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
prefs::kLanguageRemapSearchKeyTo);
}
- void OnSpokenFeedbackEnabledChanged() {
- GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(
- accessibility_enabled_.prefs()->GetBoolean(
- prefs::kSpokenFeedbackEnabled));
+ void OnAccessibilityModeChanged() {
+ GetSystemTrayNotifier()->NotifyAccessibilityModeChanged();
}
// Overridden from InputMethodManager::Observer.
@@ -1263,7 +1275,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
- BooleanPrefMember accessibility_enabled_;
+ BooleanPrefMember spoken_feedback_enabled_;
+ BooleanPrefMember high_contrast_enabled_;
scoped_ptr<DataPromoNotification> data_promo_notification_;
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 29b6784..100981f 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -1153,7 +1153,7 @@ cr.define('options', function() {
* Set the initial state of the screen magnifier dropdown.
* @private
*/
- setScreenMagnifierTypeState_: function(type) {
+ setMagnifierTypeState_: function(type) {
$('accessibility-screen-magnifier-type').value = type;
},
@@ -1298,7 +1298,7 @@ cr.define('options', function() {
'setMetricsReportingSettingVisibility',
'setPasswordGenerationSettingVisibility',
'setProfilesInfo',
- 'setScreenMagnifierTypeState',
+ 'setMagnifierTypeState',
'setSpokenFeedbackCheckboxState',
'setThemesResetButtonEnabled',
'setVirtualKeyboardCheckboxState',
diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc
index 0e0f2db..5555e88 100644
--- a/chrome/browser/ui/ash/ash_init.cc
+++ b/chrome/browser/ui/ash/ash_init.cc
@@ -94,12 +94,12 @@ void OpenAsh() {
ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(
chromeos::accessibility::IsHighContrastEnabled());
- chromeos::accessibility::ScreenMagnifierType magnifier_type =
- chromeos::accessibility::GetScreenMagnifierType();
+ ash::MagnifierType magnifier_type =
+ chromeos::accessibility::GetMagnifierType();
ash::Shell::GetInstance()->magnification_controller()->SetEnabled(
- magnifier_type == chromeos::accessibility::MAGNIFIER_FULL);
+ magnifier_type == ash::MAGNIFIER_FULL);
ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
- magnifier_type == chromeos::accessibility::MAGNIFIER_PARTIAL);
+ magnifier_type == ash::MAGNIFIER_PARTIAL);
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableZeroBrowsersOpenForTests)) {
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index ec12655..6c555a6 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/ash/chrome_shell_delegate.h"
#include "ash/launcher/launcher_types.h"
+#include "ash/magnifier/magnifier_constants.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/wm/stacking_controller.h"
#include "ash/wm/window_util.h"
@@ -340,6 +341,44 @@ bool ChromeShellDelegate::IsSpokenFeedbackEnabled() const {
#endif
}
+bool ChromeShellDelegate::IsHighContrastEnabled() const {
+#if defined(OS_CHROMEOS)
+ return chromeos::accessibility::IsHighContrastEnabled();
+#else
+ return false;
+#endif
+}
+
+void ChromeShellDelegate::ToggleHighContrast() {
+#if defined(OS_CHROMEOS)
+ bool enabled = chromeos::accessibility::IsHighContrastEnabled();
+ chromeos::accessibility::EnableHighContrast(!enabled);
+#endif
+}
+
+ash::MagnifierType ChromeShellDelegate::GetMagnifierType() const {
+#if defined(OS_CHROMEOS)
+ return chromeos::accessibility::GetMagnifierType();
+#else
+ return ash::MAGNIFIER_OFF;
+#endif
+}
+
+void ChromeShellDelegate::SetMagnifier(ash::MagnifierType type) {
+#if defined(OS_CHROMEOS)
+ chromeos::accessibility::SetMagnifier(type);
+#endif
+}
+
+bool ChromeShellDelegate::ShouldAlwaysShowAccessibilityMenu() const {
+#if defined(OS_CHROMEOS)
+ // TODO(yoshiki): Add the checkbox on chrome://settings. crbug.com/158287
+ return false;
+#else
+ return false;
+#endif
+}
+
app_list::AppListViewDelegate*
ChromeShellDelegate::CreateAppListViewDelegate() {
DCHECK(ash::Shell::HasInstance());
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h
index 52585de..79bd312 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -56,8 +56,13 @@ class ChromeShellDelegate : public ash::ShellDelegate,
virtual void ShowKeyboardOverlay() OVERRIDE;
virtual void ShowTaskManager() OVERRIDE;
virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE;
- virtual void ToggleSpokenFeedback() OVERRIDE;
+ virtual void ToggleHighContrast() OVERRIDE;
virtual bool IsSpokenFeedbackEnabled() const OVERRIDE;
+ virtual void ToggleSpokenFeedback() OVERRIDE;
+ virtual bool IsHighContrastEnabled() const OVERRIDE;
+ virtual void SetMagnifier(ash::MagnifierType type) OVERRIDE;
+ virtual ash::MagnifierType GetMagnifierType() const OVERRIDE;
+ virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE;
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
virtual ash::LauncherDelegate* CreateLauncherDelegate(
ash::LauncherModel* model) OVERRIDE;
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
index 6a9c3255..3aa6365 100644
--- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -74,8 +74,8 @@ void CoreOobeHandler::GetLocalizedStrings(
localized_strings->SetString("highContrastEnabled", "on");
if (chromeos::accessibility::IsSpokenFeedbackEnabled())
localized_strings->SetString("spokenFeedbackEnabled", "on");
- if (chromeos::accessibility::GetScreenMagnifierType() !=
- chromeos::accessibility::MAGNIFIER_OFF) {
+ if (chromeos::accessibility::GetMagnifierType() !=
+ ash::MAGNIFIER_OFF) {
localized_strings->SetString("screenMagnifierEnabled", "on");
}
}
@@ -146,10 +146,9 @@ void CoreOobeHandler::HandleEnableScreenMagnifier(const base::ListValue* args) {
return;
}
// TODO(nkostylev): Add support for partial screen magnifier.
- chromeos::accessibility::ScreenMagnifierType type = enabled ?
- chromeos::accessibility::MAGNIFIER_FULL :
- chromeos::accessibility::MAGNIFIER_OFF;
- chromeos::accessibility::SetScreenMagnifier(type);
+ ash::MagnifierType type = enabled ? ash::MAGNIFIER_FULL :
+ ash::MAGNIFIER_OFF;
+ chromeos::accessibility::SetMagnifier(type);
}
void CoreOobeHandler::HandleEnableSpokenFeedback(const base::ListValue* args) {
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index ed62d1f..d7e4e9c0 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -1265,7 +1265,7 @@ void BrowserOptionsHandler::ScreenMagnifierChangeCallback(
args->GetString(0, &type_name);
PrefService* user_pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
- user_pref_service->SetString(prefs::kScreenMagnifierType,
+ user_pref_service->SetString(prefs::kMagnifierType,
type_name);
}
@@ -1314,9 +1314,9 @@ void BrowserOptionsHandler::SetupAccessibilityFeatures() {
PrefService* user_pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
base::StringValue magnifier_type(
- user_pref_service->GetString(prefs::kScreenMagnifierType));
+ user_pref_service->GetString(prefs::kMagnifierType));
web_ui()->CallJavascriptFunction(
- "BrowserOptions.setScreenMagnifierTypeState",
+ "BrowserOptions.setMagnifierTypeState",
magnifier_type);
}
#endif
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index f8d8c70..9b8d6b5 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -737,7 +737,7 @@ const char kHighContrastEnabled[] = "settings.a11y.high_contrast_enabled";
// A double pref which determines a zooming scale of the screen magnifier.
const char kScreenMagnifierScale[] = "settings.a11y.screen_magnifier_scale";
// A string pref which determines what type of screen magnifier is enabled.
-const char kScreenMagnifierType[] = "settings.a11y.screen_magnifier_type";
+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";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 6a799a9..fe6aecb 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -268,7 +268,7 @@ extern const char kLanguageXkbAutoRepeatInterval[];
extern const char kSpokenFeedbackEnabled[];
extern const char kHighContrastEnabled[];
extern const char kScreenMagnifierScale[];
-extern const char kScreenMagnifierType[];
+extern const char kMagnifierType[];
extern const char kVirtualKeyboardEnabled[];
extern const char kLabsAdvancedFilesystemEnabled[];
extern const char kLabsMediaplayerEnabled[];
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 7776094..6bc8870 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -349,6 +349,11 @@ const char kChromeHelpViaWebUIURL[] =
"https://support.google.com/chrome/?p=help&ctx=settings";
#endif // defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
+const char kChromeAccessibilityHelpURL[] =
+ "https://support.google.com/chromeos/?p=accessibility_menu";
+#endif // defined(OS_CHROMEOS)
+
const char kChromeSyncLearnMoreURL[] =
#if defined(OS_CHROMEOS)
"http://support.google.com/chromeos/bin/answer.py?answer=165139";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index d8e3c25..dd90d0f 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -308,6 +308,11 @@ extern const char kChromeHelpViaKeyboardURL[];
extern const char kChromeHelpViaMenuURL[];
extern const char kChromeHelpViaWebUIURL[];
+#if defined(OS_CHROMEOS)
+// Accessibility help link for Chrome.
+extern const char kChromeAccessibilityHelpURL[];
+#endif
+
// "Learn more" URL for the one click signin infobar.
extern const char kChromeSyncLearnMoreURL[];