diff options
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, 18 insertions, 48 deletions
diff --git a/ash/magnifier/magnifier_constants.h b/ash/magnifier/magnifier_constants.h index aa7cac7..4ca4c89 100644 --- a/ash/magnifier/magnifier_constants.h +++ b/ash/magnifier/magnifier_constants.h @@ -7,16 +7,12 @@ namespace ash { -// Note: Do not change these values; UMA and prefs depend on them. enum MagnifierType { - MAGNIFIER_FULL = 1, - MAGNIFIER_PARTIAL = 2, + MAGNIFIER_OFF, + MAGNIFIER_FULL, + MAGNIFIER_PARTIAL, }; -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 681dfb5..fde2bd1 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -25,8 +25,7 @@ ShellDelegateImpl::ShellDelegateImpl() locked_(false), spoken_feedback_enabled_(false), high_contrast_enabled_(false), - screen_magnifier_enabled_(false), - screen_magnifier_type_(kDefaultMagnifierType) { + screen_magnifier_type_(MAGNIFIER_OFF) { } ShellDelegateImpl::~ShellDelegateImpl() { @@ -135,18 +134,10 @@ bool ShellDelegateImpl::IsHighContrastEnabled() const { return high_contrast_enabled_; } -void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) { - screen_magnifier_enabled_ = enabled; -} - -void ShellDelegateImpl::SetMagnifierType(MagnifierType type) { +void ShellDelegateImpl::SetMagnifier(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 e94d08a..3a987e2 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -46,9 +46,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual void ToggleHighContrast() OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE; - virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; - virtual void SetMagnifierType(MagnifierType type) OVERRIDE; - virtual bool IsMagnifierEnabled() const OVERRIDE; + virtual void SetMagnifier(MagnifierType type) OVERRIDE; virtual MagnifierType GetMagnifierType() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; @@ -81,7 +79,6 @@ 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 6a9dd08..bdd3958 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -149,14 +149,8 @@ class ASH_EXPORT ShellDelegate { // Returns true if high contrast mode is enabled. virtual bool IsHighContrastEnabled() const = 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; + // 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; diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index b64671a..9b1d261 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->IsMagnifierEnabled()) + if (shell_delegate->GetMagnifierType() != ash::MAGNIFIER_OFF) state |= A11Y_SCREEN_MAGNIFIER; return state; } @@ -138,7 +138,8 @@ 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->IsMagnifierEnabled(); + screen_magnifier_enabled_ = + shell_delegate->GetMagnifierType() == ash::MAGNIFIER_FULL; screen_magnifier_view_ = AddScrollListItem( bundle.GetLocalizedString( IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), @@ -197,7 +198,10 @@ void AccessibilityDetailedView::ClickedOn(views::View* sender) { } else if (sender == high_contrast_view_) { shell_delegate->ToggleHighContrast(); } else if (sender == screen_magnifier_view_) { - shell_delegate->SetMagnifierEnabled(!shell_delegate->IsMagnifierEnabled()); + bool screen_magnifier_enabled = + shell_delegate->GetMagnifierType() == ash::MAGNIFIER_FULL; + shell_delegate->SetMagnifier( + screen_magnifier_enabled ? ash::MAGNIFIER_OFF : ash::MAGNIFIER_FULL); } } diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index c2fdc60..f782c86 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -24,8 +24,7 @@ TestShellDelegate::TestShellDelegate() session_started_(true), spoken_feedback_enabled_(false), high_contrast_enabled_(false), - screen_magnifier_enabled_(false), - screen_magnifier_type_(kDefaultMagnifierType), + screen_magnifier_type_(MAGNIFIER_OFF), user_logged_in_(true), can_lock_screen_(true), num_exit_requests_(0) { @@ -125,18 +124,10 @@ bool TestShellDelegate::IsHighContrastEnabled() const { return high_contrast_enabled_; } -void TestShellDelegate::SetMagnifierEnabled(bool enabled) { - screen_magnifier_enabled_ = enabled; -} - -void TestShellDelegate::SetMagnifierType(MagnifierType type) { +void TestShellDelegate::SetMagnifier(const 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 76add5d..f7bb171 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -45,9 +45,7 @@ class TestShellDelegate : public ShellDelegate { virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual void ToggleHighContrast() OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE; - virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; - virtual void SetMagnifierType(MagnifierType type) OVERRIDE; - virtual bool IsMagnifierEnabled() const OVERRIDE; + virtual void SetMagnifier(MagnifierType type) OVERRIDE; virtual MagnifierType GetMagnifierType() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; @@ -96,7 +94,6 @@ 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_; |