diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-10 15:08:11 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-10 15:08:11 +0000 |
commit | 5c6c6f55b07c37377e43b01d2a9dbb25756cdc1b (patch) | |
tree | 724882355eaa2e33711d69ef3418346429c4e55e /ash | |
parent | 151ab510191868fecd29300ade986d5c4ffcc3bd (diff) | |
download | chromium_src-5c6c6f55b07c37377e43b01d2a9dbb25756cdc1b.zip chromium_src-5c6c6f55b07c37377e43b01d2a9dbb25756cdc1b.tar.gz chromium_src-5c6c6f55b07c37377e43b01d2a9dbb25756cdc1b.tar.bz2 |
Re-introduce the partial magnifier
Major Changes:
- Adding a selectbox at the right of screen magnifier setting on the setting page.
- Adding 'screen_magnifier_type2' pref.
- Separating the enable/disable state of magnifier from MagnifierType. MagnifierType does no longer indicate the current enable/disable status.
- Add IsMagnifierEnabled() to shell delegate.
BUG=166832
TEST=confirm that magnifier can be enabled/disabled via the tray and the settings page. browser_test passes.
R=zork@chromium.org, derat@chromium.org, nkostylev@chromium.org
TBR=jhawkins@chromium.org
# TBRing for small changed in C/B/ui/webui/options/ and C/B/resources/options/
Review URL: https://chromiumcodereview.appspot.com/11642014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/magnifier/magnifier_constants.h | 10 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.cc | 13 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.h | 5 | ||||
-rw-r--r-- | ash/shell_delegate.h | 10 | ||||
-rw-r--r-- | ash/system/tray_accessibility.cc | 10 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 13 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.h | 5 |
7 files changed, 48 insertions, 18 deletions
diff --git a/ash/magnifier/magnifier_constants.h b/ash/magnifier/magnifier_constants.h index 4ca4c89..aa7cac7 100644 --- a/ash/magnifier/magnifier_constants.h +++ b/ash/magnifier/magnifier_constants.h @@ -7,12 +7,16 @@ namespace ash { +// Note: Do not change these values; UMA and prefs depend on them. enum MagnifierType { - MAGNIFIER_OFF, - MAGNIFIER_FULL, - MAGNIFIER_PARTIAL, + MAGNIFIER_FULL = 1, + MAGNIFIER_PARTIAL = 2, }; +const int kMaxMagnifierType = 2; + +const MagnifierType kDefaultMagnifierType = MAGNIFIER_FULL; + } // 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 fde2bd1..681dfb5 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -25,7 +25,8 @@ ShellDelegateImpl::ShellDelegateImpl() locked_(false), spoken_feedback_enabled_(false), high_contrast_enabled_(false), - screen_magnifier_type_(MAGNIFIER_OFF) { + screen_magnifier_enabled_(false), + screen_magnifier_type_(kDefaultMagnifierType) { } ShellDelegateImpl::~ShellDelegateImpl() { @@ -134,10 +135,18 @@ bool ShellDelegateImpl::IsHighContrastEnabled() const { return high_contrast_enabled_; } -void ShellDelegateImpl::SetMagnifier(MagnifierType type) { +void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) { + screen_magnifier_enabled_ = enabled; +} + +void ShellDelegateImpl::SetMagnifierType(MagnifierType type) { screen_magnifier_type_ = type; } +bool ShellDelegateImpl::IsMagnifierEnabled() const { + return screen_magnifier_enabled_; +} + MagnifierType ShellDelegateImpl::GetMagnifierType() const { return screen_magnifier_type_; } diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index 3a987e2..e94d08a 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -46,7 +46,9 @@ class ShellDelegateImpl : public ash::ShellDelegate { virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual void ToggleHighContrast() OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE; - virtual void SetMagnifier(MagnifierType type) OVERRIDE; + virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; + virtual void SetMagnifierType(MagnifierType type) OVERRIDE; + virtual bool IsMagnifierEnabled() const OVERRIDE; virtual MagnifierType GetMagnifierType() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; @@ -79,6 +81,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { bool locked_; bool spoken_feedback_enabled_; bool high_contrast_enabled_; + bool screen_magnifier_enabled_; MagnifierType screen_magnifier_type_; DISALLOW_COPY_AND_ASSIGN(ShellDelegateImpl); diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index bdd3958..6a9dd08 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -149,8 +149,14 @@ class ASH_EXPORT ShellDelegate { // 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; + // Invoked to enable the screen magnifier. + virtual void SetMagnifierEnabled(bool enabled) = 0; + + // Invoked to change the type of the screen magnifier. + virtual void SetMagnifierType(MagnifierType type) = 0; + + // Returns if the screen magnifier is enabled or not. + virtual bool IsMagnifierEnabled() const = 0; // Returns the current screen magnifier mode. virtual MagnifierType GetMagnifierType() const = 0; diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index 9b1d261..b64671a 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc @@ -44,7 +44,7 @@ uint32 GetAccessibilityState() { state |= A11Y_SPOKEN_FEEDBACK; if (shell_delegate->IsHighContrastEnabled()) state |= A11Y_HIGH_CONTRAST; - if (shell_delegate->GetMagnifierType() != ash::MAGNIFIER_OFF) + if (shell_delegate->IsMagnifierEnabled()) state |= A11Y_SCREEN_MAGNIFIER; return state; } @@ -138,8 +138,7 @@ void AccessibilityDetailedView::AppendAccessibilityList() { IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), high_contrast_enabled_ ? gfx::Font::BOLD : gfx::Font::NORMAL, high_contrast_enabled_); - screen_magnifier_enabled_ = - shell_delegate->GetMagnifierType() == ash::MAGNIFIER_FULL; + screen_magnifier_enabled_ = shell_delegate->IsMagnifierEnabled(); screen_magnifier_view_ = AddScrollListItem( bundle.GetLocalizedString( IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), @@ -198,10 +197,7 @@ void AccessibilityDetailedView::ClickedOn(views::View* sender) { } 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); + shell_delegate->SetMagnifierEnabled(!shell_delegate->IsMagnifierEnabled()); } } diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index f782c86..c2fdc60 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -24,7 +24,8 @@ TestShellDelegate::TestShellDelegate() session_started_(true), spoken_feedback_enabled_(false), high_contrast_enabled_(false), - screen_magnifier_type_(MAGNIFIER_OFF), + screen_magnifier_enabled_(false), + screen_magnifier_type_(kDefaultMagnifierType), user_logged_in_(true), can_lock_screen_(true), num_exit_requests_(0) { @@ -124,10 +125,18 @@ bool TestShellDelegate::IsHighContrastEnabled() const { return high_contrast_enabled_; } -void TestShellDelegate::SetMagnifier(const MagnifierType type) { +void TestShellDelegate::SetMagnifierEnabled(bool enabled) { + screen_magnifier_enabled_ = enabled; +} + +void TestShellDelegate::SetMagnifierType(MagnifierType type) { screen_magnifier_type_ = type; } +bool TestShellDelegate::IsMagnifierEnabled() const { + return screen_magnifier_enabled_; +} + MagnifierType TestShellDelegate::GetMagnifierType() const { return screen_magnifier_type_; } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index f7bb171..76add5d 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -45,7 +45,9 @@ class TestShellDelegate : public ShellDelegate { virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual void ToggleHighContrast() OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE; - virtual void SetMagnifier(MagnifierType type) OVERRIDE; + virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; + virtual void SetMagnifierType(MagnifierType type) OVERRIDE; + virtual bool IsMagnifierEnabled() const OVERRIDE; virtual MagnifierType GetMagnifierType() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; @@ -94,6 +96,7 @@ class TestShellDelegate : public ShellDelegate { bool session_started_; bool spoken_feedback_enabled_; bool high_contrast_enabled_; + bool screen_magnifier_enabled_; MagnifierType screen_magnifier_type_; bool user_logged_in_; bool can_lock_screen_; |