0

cros: Remove unused a11y partial screen magnifier code

The partial screen ("lens") magnifier accessibility feature was
deprioritized in 2013 and never shipped. Removing the code eliminates
ash-to-chrome delegate methods, which we need to do for go/mustash.

Bug: 170850, 594887
Test: ash_unittests, chrome browser_tests
Change-Id: I258761fbecedc5d6ebfe888e08a19756a2371566
Reviewed-on: https://chromium-review.googlesource.com/636347
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498468}
This commit is contained in:
James Cook
2017-08-30 15:18:24 +00:00
committed by Commit Bot
parent 92cceac320
commit db81c76776
18 changed files with 25 additions and 261 deletions

@@ -33,15 +33,9 @@ class ASH_EXPORT AccessibilityDelegate {
// Invoked to enable the screen magnifier. // Invoked to enable the screen magnifier.
virtual void SetMagnifierEnabled(bool enabled) = 0; virtual void SetMagnifierEnabled(bool enabled) = 0;
// Invoked to change the type of the screen magnifier.
virtual void SetMagnifierType(MagnifierType type) = 0;
// Returns true if the screen magnifier is enabled. // Returns true if the screen magnifier is enabled.
virtual bool IsMagnifierEnabled() const = 0; virtual bool IsMagnifierEnabled() const = 0;
// Returns the current screen magnifier mode.
virtual MagnifierType GetMagnifierType() const = 0;
// Invoked to enable Large Cursor. // Invoked to enable Large Cursor.
virtual void SetLargeCursorEnabled(bool enabled) = 0; virtual void SetLargeCursorEnabled(bool enabled) = 0;

@@ -24,14 +24,12 @@ enum AccessibilityAlert {
// Note: Do not change these values; UMA and prefs depend on them. // Note: Do not change these values; UMA and prefs depend on them.
enum MagnifierType { enum MagnifierType {
MAGNIFIER_DISABLED = 0, // Used by enterprise policy.
MAGNIFIER_FULL = 1, MAGNIFIER_FULL = 1,
MAGNIFIER_PARTIAL = 2, // Never shipped. Deprioritized in 2013. http://crbug.com/170850
// MAGNIFIER_PARTIAL = 2,
}; };
const int kMaxMagnifierType = 2;
const MagnifierType kDefaultMagnifierType = MAGNIFIER_FULL;
// Factor of magnification scale. For example, when this value is 1.189, scale // Factor of magnification scale. For example, when this value is 1.189, scale
// value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ...
// Note: this value is 2.0 ^ (1 / 4). // Note: this value is 2.0 ^ (1 / 4).

@@ -28,18 +28,10 @@ void DefaultAccessibilityDelegate::SetMagnifierEnabled(bool enabled) {
screen_magnifier_enabled_ = enabled; screen_magnifier_enabled_ = enabled;
} }
void DefaultAccessibilityDelegate::SetMagnifierType(MagnifierType type) {
screen_magnifier_type_ = type;
}
bool DefaultAccessibilityDelegate::IsMagnifierEnabled() const { bool DefaultAccessibilityDelegate::IsMagnifierEnabled() const {
return screen_magnifier_enabled_; return screen_magnifier_enabled_;
} }
MagnifierType DefaultAccessibilityDelegate::GetMagnifierType() const {
return screen_magnifier_type_;
}
void DefaultAccessibilityDelegate::SetLargeCursorEnabled(bool enabled) { void DefaultAccessibilityDelegate::SetLargeCursorEnabled(bool enabled) {
large_cursor_enabled_ = enabled; large_cursor_enabled_ = enabled;
} }

@@ -21,9 +21,7 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate {
void ToggleHighContrast() override; void ToggleHighContrast() override;
bool IsHighContrastEnabled() const override; bool IsHighContrastEnabled() const override;
void SetMagnifierEnabled(bool enabled) override; void SetMagnifierEnabled(bool enabled) override;
void SetMagnifierType(MagnifierType type) override;
bool IsMagnifierEnabled() const override; bool IsMagnifierEnabled() const override;
MagnifierType GetMagnifierType() const override;
void SetLargeCursorEnabled(bool enabled) override; void SetLargeCursorEnabled(bool enabled) override;
bool IsLargeCursorEnabled() const override; bool IsLargeCursorEnabled() const override;
void SetAutoclickEnabled(bool enabled) override; void SetAutoclickEnabled(bool enabled) override;
@@ -66,7 +64,6 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate {
bool spoken_feedback_enabled_ = false; bool spoken_feedback_enabled_ = false;
bool high_contrast_enabled_ = false; bool high_contrast_enabled_ = false;
bool screen_magnifier_enabled_ = false; bool screen_magnifier_enabled_ = false;
MagnifierType screen_magnifier_type_ = kDefaultMagnifierType;
bool large_cursor_enabled_ = false; bool large_cursor_enabled_ = false;
bool autoclick_enabled_ = false; bool autoclick_enabled_ = false;
bool virtual_keyboard_enabled_ = false; bool virtual_keyboard_enabled_ = false;
@@ -79,6 +76,7 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate {
bool select_to_speak_enabled_ = false; bool select_to_speak_enabled_ = false;
bool switch_access_enabled_ = false; bool switch_access_enabled_ = false;
AccessibilityAlert accessibility_alert_ = A11Y_ALERT_NONE; AccessibilityAlert accessibility_alert_ = A11Y_ALERT_NONE;
DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityDelegate); DISALLOW_COPY_AND_ASSIGN(DefaultAccessibilityDelegate);
}; };

@@ -32,6 +32,7 @@ const char kAccessibilityScreenMagnifierCenterFocus[] =
// An integer pref which determines what type of screen magnifier is enabled. // An integer pref which determines what type of screen magnifier is enabled.
// Note that: 'screen_magnifier_type' had been used as string pref. Hence, // Note that: 'screen_magnifier_type' had been used as string pref. Hence,
// we are using another name pref here. // we are using another name pref here.
// NOTE: We only shipped one type (full). http://crbug.com/170850
const char kAccessibilityScreenMagnifierType[] = const char kAccessibilityScreenMagnifierType[] =
"settings.a11y.screen_magnifier_type2"; "settings.a11y.screen_magnifier_type2";
// A double pref which determines a zooming scale of the screen magnifier. // A double pref which determines a zooming scale of the screen magnifier.

@@ -158,17 +158,6 @@ AccessibilityStatusEventDetails::AccessibilityStatusEventDetails(
ash::AccessibilityNotificationVisibility notify) ash::AccessibilityNotificationVisibility notify)
: notification_type(notification_type), : notification_type(notification_type),
enabled(enabled), enabled(enabled),
magnifier_type(ash::kDefaultMagnifierType),
notify(notify) {}
AccessibilityStatusEventDetails::AccessibilityStatusEventDetails(
AccessibilityNotificationType notification_type,
bool enabled,
ash::MagnifierType magnifier_type,
ash::AccessibilityNotificationVisibility notify)
: notification_type(notification_type),
enabled(enabled),
magnifier_type(magnifier_type),
notify(notify) {} notify(notify) {}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@@ -1383,12 +1372,8 @@ void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() {
IsVirtualKeyboardEnabled()); IsVirtualKeyboardEnabled());
UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled()); UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosStickyKeys", IsStickyKeysEnabled());
if (MagnificationManager::Get()) { if (MagnificationManager::Get()) {
uint32_t type = MagnificationManager::Get()->IsMagnifierEnabled() UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosScreenMagnifier",
? MagnificationManager::Get()->GetMagnifierType() MagnificationManager::Get()->IsMagnifierEnabled());
: 0;
// '0' means magnifier is disabled.
UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", type,
ash::kMaxMagnifierType + 1);
} }
if (profile_) { if (profile_) {
const PrefService* const prefs = profile_->GetPrefs(); const PrefService* const prefs = profile_->GetPrefs();

@@ -62,15 +62,8 @@ struct AccessibilityStatusEventDetails {
bool enabled, bool enabled,
ash::AccessibilityNotificationVisibility notify); ash::AccessibilityNotificationVisibility notify);
AccessibilityStatusEventDetails(
AccessibilityNotificationType notification_type,
bool enabled,
ash::MagnifierType magnifier_type,
ash::AccessibilityNotificationVisibility notify);
AccessibilityNotificationType notification_type; AccessibilityNotificationType notification_type;
bool enabled; bool enabled;
ash::MagnifierType magnifier_type;
ash::AccessibilityNotificationVisibility notify; ash::AccessibilityNotificationVisibility notify;
}; };

@@ -44,11 +44,8 @@ class MagnificationManagerImpl
: profile_(NULL), : profile_(NULL),
magnifier_enabled_pref_handler_( magnifier_enabled_pref_handler_(
ash::prefs::kAccessibilityScreenMagnifierEnabled), ash::prefs::kAccessibilityScreenMagnifierEnabled),
magnifier_type_pref_handler_(
ash::prefs::kAccessibilityScreenMagnifierType),
magnifier_scale_pref_handler_( magnifier_scale_pref_handler_(
ash::prefs::kAccessibilityScreenMagnifierScale), ash::prefs::kAccessibilityScreenMagnifierScale),
type_(ash::kDefaultMagnifierType),
enabled_(false), enabled_(false),
keep_focus_centered_(false), keep_focus_centered_(false),
observing_focus_change_in_page_(false) { observing_focus_change_in_page_(false) {
@@ -70,8 +67,6 @@ class MagnificationManagerImpl
// MagnificationManager implimentation: // MagnificationManager implimentation:
bool IsMagnifierEnabled() const override { return enabled_; } bool IsMagnifierEnabled() const override { return enabled_; }
ash::MagnifierType GetMagnifierType() const override { return type_; }
void SetMagnifierEnabled(bool enabled) override { void SetMagnifierEnabled(bool enabled) override {
if (!profile_) if (!profile_)
return; return;
@@ -82,15 +77,6 @@ class MagnificationManagerImpl
prefs->CommitPendingWrite(); prefs->CommitPendingWrite();
} }
void SetMagnifierType(ash::MagnifierType type) override {
if (!profile_)
return;
PrefService* prefs = profile_->GetPrefs();
prefs->SetInteger(ash::prefs::kAccessibilityScreenMagnifierType, type);
prefs->CommitPendingWrite();
}
void SaveScreenMagnifierScale(double scale) override { void SaveScreenMagnifierScale(double scale) override {
if (!profile_) if (!profile_)
return; return;
@@ -127,10 +113,6 @@ class MagnificationManagerImpl
ash::prefs::kAccessibilityScreenMagnifierEnabled, ash::prefs::kAccessibilityScreenMagnifierEnabled,
base::Bind(&MagnificationManagerImpl::UpdateMagnifierFromPrefs, base::Bind(&MagnificationManagerImpl::UpdateMagnifierFromPrefs,
base::Unretained(this))); base::Unretained(this)));
pref_change_registrar_->Add(
ash::prefs::kAccessibilityScreenMagnifierType,
base::Bind(&MagnificationManagerImpl::UpdateMagnifierFromPrefs,
base::Unretained(this)));
pref_change_registrar_->Add( pref_change_registrar_->Add(
ash::prefs::kAccessibilityScreenMagnifierCenterFocus, ash::prefs::kAccessibilityScreenMagnifierCenterFocus,
base::Bind(&MagnificationManagerImpl::UpdateMagnifierFromPrefs, base::Bind(&MagnificationManagerImpl::UpdateMagnifierFromPrefs,
@@ -138,7 +120,6 @@ class MagnificationManagerImpl
} }
magnifier_enabled_pref_handler_.HandleProfileChanged(profile_, profile); magnifier_enabled_pref_handler_.HandleProfileChanged(profile_, profile);
magnifier_type_pref_handler_.HandleProfileChanged(profile_, profile);
magnifier_scale_pref_handler_.HandleProfileChanged(profile_, profile); magnifier_scale_pref_handler_.HandleProfileChanged(profile_, profile);
profile_ = profile; profile_ = profile;
@@ -156,20 +137,8 @@ class MagnificationManagerImpl
enabled_ = enabled; enabled_ = enabled;
if (type_ == ash::MAGNIFIER_FULL) { ash::Shell::Get()->magnification_controller()->SetEnabled(enabled_);
ash::Shell::Get()->magnification_controller()->SetEnabled(enabled_); MonitorFocusInPageChange();
MonitorFocusInPageChange();
} else {
ash::Shell::Get()->partial_magnification_controller()->SetEnabled(
enabled_);
}
}
virtual void SetMagnifierTypeInternal(ash::MagnifierType type) {
if (type_ == type)
return;
type_ = ash::MAGNIFIER_FULL; // (leave out for full magnifier)
} }
virtual void SetMagniferKeepFocusCenteredInternal(bool keep_focus_centered) { virtual void SetMagniferKeepFocusCenteredInternal(bool keep_focus_centered) {
@@ -178,10 +147,8 @@ class MagnificationManagerImpl
keep_focus_centered_ = keep_focus_centered; keep_focus_centered_ = keep_focus_centered;
if (type_ == ash::MAGNIFIER_FULL) {
ash::Shell::Get()->magnification_controller()->SetKeepFocusCentered( ash::Shell::Get()->magnification_controller()->SetKeepFocusCentered(
keep_focus_centered_); keep_focus_centered_);
}
} }
void UpdateMagnifierFromPrefs() { void UpdateMagnifierFromPrefs() {
@@ -190,34 +157,19 @@ class MagnificationManagerImpl
const bool enabled = profile_->GetPrefs()->GetBoolean( const bool enabled = profile_->GetPrefs()->GetBoolean(
ash::prefs::kAccessibilityScreenMagnifierEnabled); ash::prefs::kAccessibilityScreenMagnifierEnabled);
const int type_integer = profile_->GetPrefs()->GetInteger(
ash::prefs::kAccessibilityScreenMagnifierType);
const bool keep_focus_centered = profile_->GetPrefs()->GetBoolean( const bool keep_focus_centered = profile_->GetPrefs()->GetBoolean(
ash::prefs::kAccessibilityScreenMagnifierCenterFocus); ash::prefs::kAccessibilityScreenMagnifierCenterFocus);
ash::MagnifierType type = ash::kDefaultMagnifierType;
if (type_integer > 0 && type_integer <= ash::kMaxMagnifierType) {
type = static_cast<ash::MagnifierType>(type_integer);
} else if (type_integer == 0) {
// Type 0 is used to disable the screen magnifier through policy. As the
// magnifier type is irrelevant in this case, it is OK to just fall back
// to the default.
} else {
NOTREACHED();
}
if (!enabled) { if (!enabled) {
SetMagnifierEnabledInternal(enabled); SetMagnifierEnabledInternal(enabled);
SetMagnifierTypeInternal(type);
SetMagniferKeepFocusCenteredInternal(keep_focus_centered); SetMagniferKeepFocusCenteredInternal(keep_focus_centered);
} else { } else {
SetMagniferKeepFocusCenteredInternal(keep_focus_centered); SetMagniferKeepFocusCenteredInternal(keep_focus_centered);
SetMagnifierTypeInternal(type);
SetMagnifierEnabledInternal(enabled); SetMagnifierEnabledInternal(enabled);
} }
AccessibilityStatusEventDetails details( AccessibilityStatusEventDetails details(
ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, enabled_, type_, ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, enabled_,
ash::A11Y_NOTIFICATION_NONE); ash::A11Y_NOTIFICATION_NONE);
if (AccessibilityManager::Get()) { if (AccessibilityManager::Get()) {
@@ -283,10 +235,8 @@ class MagnificationManagerImpl
Profile* profile_; Profile* profile_;
AccessibilityManager::PrefHandler magnifier_enabled_pref_handler_; AccessibilityManager::PrefHandler magnifier_enabled_pref_handler_;
AccessibilityManager::PrefHandler magnifier_type_pref_handler_;
AccessibilityManager::PrefHandler magnifier_scale_pref_handler_; AccessibilityManager::PrefHandler magnifier_scale_pref_handler_;
ash::MagnifierType type_;
bool enabled_; bool enabled_;
bool keep_focus_centered_; bool keep_focus_centered_;
bool observing_focus_change_in_page_; bool observing_focus_change_in_page_;

@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_MAGNIFICATION_MANAGER_H_ #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_MAGNIFICATION_MANAGER_H_
#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_MAGNIFICATION_MANAGER_H_ #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_MAGNIFICATION_MANAGER_H_
#include "ash/accessibility_types.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
class Profile; class Profile;
@@ -20,12 +19,9 @@ namespace chromeos {
// desktop. // desktop.
// - Watch change of the pref. When the pref changes, the setting of the // - Watch change of the pref. When the pref changes, the setting of the
// magnifier will interlock with it. // magnifier will interlock with it.
class MagnificationManager { class MagnificationManager {
public: public:
// Creates an instance of MagnificationManager. This should be called once, // Creates an instance of MagnificationManager. This should be called once.
// Returns the existing instance. If there is no instance, creates one.
// because only one instance should exist at the same time.
static void Initialize(); static void Initialize();
// Deletes the existing instance of MagnificationManager. // Deletes the existing instance of MagnificationManager.
@@ -37,15 +33,9 @@ class MagnificationManager {
// Returns if the screen magnifier is enabled. // Returns if the screen magnifier is enabled.
virtual bool IsMagnifierEnabled() const = 0; virtual bool IsMagnifierEnabled() const = 0;
// Returns the current type of the screen magnifier.
virtual ash::MagnifierType GetMagnifierType() const = 0;
// Enables the screen magnifier. // Enables the screen magnifier.
virtual void SetMagnifierEnabled(bool enabled) = 0; virtual void SetMagnifierEnabled(bool enabled) = 0;
// Changes the type of the screen magnifier.
virtual void SetMagnifierType(ash::MagnifierType type) = 0;
// Saves the magnifier scale to the pref. // Saves the magnifier scale to the pref.
virtual void SaveScreenMagnifierScale(double scale) = 0; virtual void SaveScreenMagnifierScale(double scale) = 0;

@@ -39,10 +39,6 @@ void SetMagnifierEnabled(bool enabled) {
MagnificationManager::Get()->SetMagnifierEnabled(enabled); MagnificationManager::Get()->SetMagnifierEnabled(enabled);
} }
void SetMagnifierType(ash::MagnifierType type) {
MagnificationManager::Get()->SetMagnifierType(type);
}
void SetFullScreenMagnifierScale(double scale) { void SetFullScreenMagnifierScale(double scale) {
ash::Shell::Get()->magnification_controller()->SetScale(scale, false); ash::Shell::Get()->magnification_controller()->SetScale(scale, false);
} }
@@ -59,10 +55,6 @@ double GetSavedFullScreenMagnifierScale() {
return MagnificationManager::Get()->GetSavedScreenMagnifierScale(); return MagnificationManager::Get()->GetSavedScreenMagnifierScale();
} }
ash::MagnifierType GetMagnifierType() {
return MagnificationManager::Get()->GetMagnifierType();
}
bool IsMagnifierEnabled() { bool IsMagnifierEnabled() {
return MagnificationManager::Get()->IsMagnifierEnabled(); return MagnificationManager::Get()->IsMagnifierEnabled();
} }
@@ -122,10 +114,7 @@ void StartUserSession(const AccountId& account_id) {
class MockMagnificationObserver { class MockMagnificationObserver {
public: public:
MockMagnificationObserver() : observed_(false), MockMagnificationObserver() {
observed_enabled_(false),
magnifier_type_(-1)
{
AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
CHECK(accessibility_manager); CHECK(accessibility_manager);
accessibility_subscription_ = accessibility_manager->RegisterCallback( accessibility_subscription_ = accessibility_manager->RegisterCallback(
@@ -137,7 +126,6 @@ class MockMagnificationObserver {
bool observed() const { return observed_; } bool observed() const { return observed_; }
bool observed_enabled() const { return observed_enabled_; } bool observed_enabled() const { return observed_enabled_; }
int magnifier_type() const { return magnifier_type_; }
void reset() { observed_ = false; } void reset() { observed_ = false; }
@@ -145,15 +133,13 @@ class MockMagnificationObserver {
void OnAccessibilityStatusChanged( void OnAccessibilityStatusChanged(
const AccessibilityStatusEventDetails& details) { const AccessibilityStatusEventDetails& details) {
if (details.notification_type == ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER) { if (details.notification_type == ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER) {
magnifier_type_ = details.magnifier_type;
observed_enabled_ = details.enabled; observed_enabled_ = details.enabled;
observed_ = true; observed_ = true;
} }
} }
bool observed_; bool observed_ = false;
bool observed_enabled_; bool observed_enabled_ = false;
int magnifier_type_;
std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
@@ -215,7 +201,6 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) {
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
// Confirms that magnifier is enabled. // Confirms that magnifier is enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
} }
@@ -233,10 +218,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) {
// Enables magnifier on login screen. // Enables magnifier on login screen.
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
SetMagnifierType(ash::MAGNIFIER_FULL);
SetFullScreenMagnifierScale(2.5); SetFullScreenMagnifierScale(2.5);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
// Logs in (but the session is not started yet). // Logs in (but the session is not started yet).
@@ -245,7 +228,6 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) {
// Confirms that magnifier is keeping enabled. // Confirms that magnifier is keeping enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
StartUserSession(test_account_id_); StartUserSession(test_account_id_);
@@ -281,7 +263,6 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) {
// Confirms that the magnifier is enabled and configured according to the // Confirms that the magnifier is enabled and configured according to the
// explicitly set prefs just after session start. // explicitly set prefs just after session start.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
} }
@@ -298,11 +279,9 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) {
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) {
// Enables magnifier on login screen. // Enables magnifier on login screen.
SetMagnifierType(ash::MAGNIFIER_FULL);
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
SetFullScreenMagnifierScale(3.0); SetFullScreenMagnifierScale(3.0);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); EXPECT_EQ(3.0, GetFullScreenMagnifierScale());
// Logs in (but the session is not started yet). // Logs in (but the session is not started yet).
@@ -311,14 +290,12 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) {
// Confirms that magnifier is keeping enabled. // Confirms that magnifier is keeping enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
StartUserSession(test_account_id_); StartUserSession(test_account_id_);
// Confirms that the magnifier is enabled and configured according to the // Confirms that the magnifier is enabled and configured according to the
// explicitly set prefs just after session start. // explicitly set prefs just after session start.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
} }
@@ -330,10 +307,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) {
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) {
// Enables full screen magnifier. // Enables full screen magnifier.
SetMagnifierType(ash::MAGNIFIER_FULL);
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Logs in (but the session is not started yet). // Logs in (but the session is not started yet).
session_manager::SessionManager::Get()->CreateSession(test_account_id_, session_manager::SessionManager::Get()->CreateSession(test_account_id_,
@@ -341,7 +316,6 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) {
// Confirms that magnifier is keeping enabled. // Confirms that magnifier is keeping enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
StartUserSession(test_account_id_); StartUserSession(test_account_id_);
@@ -373,11 +347,9 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) {
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) {
// Enables magnifier on login screen. // Enables magnifier on login screen.
SetMagnifierType(ash::MAGNIFIER_FULL);
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
SetFullScreenMagnifierScale(2.5); SetFullScreenMagnifierScale(2.5);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
// Logs in (but the session is not started yet). // Logs in (but the session is not started yet).
@@ -386,13 +358,11 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) {
// Confirms that magnifier is keeping enabled. // Confirms that magnifier is keeping enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
StartUserSession(test_account_id_); StartUserSession(test_account_id_);
// Confirms that magnifier keeps enabled. // Confirms that magnifier keeps enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
} }
@@ -415,63 +385,6 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) {
EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
} }
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) {
// Enables/disables full screen magnifier.
SetMagnifierEnabled(false);
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierEnabled(false);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Enables/disables partial screen magnifier.
SetMagnifierType(ash::MAGNIFIER_PARTIAL);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierEnabled(false);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Changes the magnifier type when the magnifier is enabled.
SetMagnifierType(ash::MAGNIFIER_FULL);
SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierType(ash::MAGNIFIER_PARTIAL);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Changes the magnifier type when the magnifier is disabled.
SetMagnifierEnabled(false);
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierType(ash::MAGNIFIER_PARTIAL);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
// Logs in // Logs in
session_manager::SessionManager::Get()->CreateSession(test_account_id_, session_manager::SessionManager::Get()->CreateSession(test_account_id_,
@@ -486,7 +399,6 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
SetScreenMagnifierEnabledPref(true); SetScreenMagnifierEnabledPref(true);
// Confirms that magnifier is enabled. // Confirms that magnifier is enabled.
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
} }
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) { IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) {
@@ -497,10 +409,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) {
SetSavedFullScreenMagnifierScale(2.5); SetSavedFullScreenMagnifierScale(2.5);
// Enables full screen magnifier. // Enables full screen magnifier.
SetMagnifierType(ash::MAGNIFIER_FULL);
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Confirms that 2.5x is restored. // Confirms that 2.5x is restored.
EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
@@ -519,10 +429,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, InvalidScalePref) {
SetSavedFullScreenMagnifierScale(0.5); SetSavedFullScreenMagnifierScale(0.5);
// Enables full screen magnifier. // Enables full screen magnifier.
SetMagnifierType(ash::MAGNIFIER_FULL);
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Confirms that the actual scale is set to the minimum scale. // Confirms that the actual scale is set to the minimum scale.
EXPECT_EQ(1.0, GetFullScreenMagnifierScale()); EXPECT_EQ(1.0, GetFullScreenMagnifierScale());
@@ -537,31 +445,25 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, InvalidScalePref) {
// Enables full screen magnifier. // Enables full screen magnifier.
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Confirms that the actual scale is set to the maximum scale. // Confirms that the actual scale is set to the maximum scale.
EXPECT_EQ(4.0, GetFullScreenMagnifierScale()); EXPECT_EQ(4.0, GetFullScreenMagnifierScale());
} }
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, MagnificationObserver) {
ChangingTypeInvokesNotification) {
MockMagnificationObserver observer; MockMagnificationObserver observer;
EXPECT_FALSE(observer.observed()); EXPECT_FALSE(observer.observed());
// Set full screen magnifier, and confirm the observer is called. // Set full screen magnifier, and confirm the observer is called.
SetMagnifierEnabled(true); SetMagnifierEnabled(true);
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_TRUE(observer.observed()); EXPECT_TRUE(observer.observed());
EXPECT_TRUE(observer.observed_enabled()); EXPECT_TRUE(observer.observed_enabled());
EXPECT_EQ(observer.magnifier_type(), ash::MAGNIFIER_FULL);
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
observer.reset(); observer.reset();
// Set full screen magnifier again, and confirm the observer is not called. // Set full screen magnifier again, and confirm the observer is not called.
SetMagnifierType(ash::MAGNIFIER_FULL); SetMagnifierEnabled(true);
EXPECT_FALSE(observer.observed()); EXPECT_FALSE(observer.observed());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
observer.reset(); observer.reset();
} }

@@ -25,20 +25,12 @@ bool IsMagnifierEnabled() {
return MagnificationManager::Get()->IsMagnifierEnabled(); return MagnificationManager::Get()->IsMagnifierEnabled();
} }
ash::MagnifierType GetMagnifierType() {
return MagnificationManager::Get()->GetMagnifierType();
}
void SetMagnifierType(ash::MagnifierType type) {
return MagnificationManager::Get()->SetMagnifierType(type);
}
} // namespace } // namespace
class MagnificationManagerTest : public ash::AshTestBase { class MagnificationManagerTest : public ash::AshTestBase {
public: public:
MagnificationManagerTest() { MagnificationManagerTest() = default;
} ~MagnificationManagerTest() override = default;
void SetUp() override { void SetUp() override {
ash::AshTestBase::SetUp(); ash::AshTestBase::SetUp();
@@ -55,22 +47,14 @@ class MagnificationManagerTest : public ash::AshTestBase {
TestingProfile profile_; TestingProfile profile_;
}; };
TEST_F(MagnificationManagerTest, ChangeType) { TEST_F(MagnificationManagerTest, EnableDisable) {
// Set full screen magnifier, and confirm the status is set successfully. // Set full screen magnifier, and confirm the status is set successfully.
EnableMagnifier(); EnableMagnifier();
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_TRUE(IsMagnifierEnabled()); EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
// Set partial screen magnifier, and confirm the change is ignored.
SetMagnifierType(ash::MAGNIFIER_PARTIAL);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
// Disables magnifier, and confirm the status is set successfully. // Disables magnifier, and confirm the status is set successfully.
DisableMagnifier(); DisableMagnifier();
EXPECT_FALSE(IsMagnifierEnabled()); EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
} }
} // namespace chromeos } // namespace chromeos

@@ -339,7 +339,7 @@ void PinnedLauncherAppsPolicyHandler::ApplyList(
ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler() ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler()
: IntRangePolicyHandlerBase(key::kScreenMagnifierType, : IntRangePolicyHandlerBase(key::kScreenMagnifierType,
0, ash::MAGNIFIER_DISABLED,
ash::MAGNIFIER_FULL, ash::MAGNIFIER_FULL,
false) {} false) {}
@@ -353,7 +353,7 @@ void ScreenMagnifierPolicyHandler::ApplyPolicySettings(
int value_in_range; int value_in_range;
if (value && EnsureInRange(value, &value_in_range, NULL)) { if (value && EnsureInRange(value, &value_in_range, NULL)) {
prefs->SetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled, prefs->SetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled,
value_in_range != 0); value_in_range != ash::MAGNIFIER_DISABLED);
prefs->SetInteger(ash::prefs::kAccessibilityScreenMagnifierType, prefs->SetInteger(ash::prefs::kAccessibilityScreenMagnifierType,
value_in_range); value_in_range);
} }

@@ -333,7 +333,6 @@ IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyLoginScreenBrowsertest,
chromeos::MagnificationManager::Get(); chromeos::MagnificationManager::Get();
ASSERT_TRUE(magnification_manager); ASSERT_TRUE(magnification_manager);
EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); EXPECT_TRUE(magnification_manager->IsMagnifierEnabled());
EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType());
} }
IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyInSessionBrowsertest, IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyInSessionBrowsertest,
@@ -434,8 +433,6 @@ IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyInSessionBrowsertest,
chromeos::MagnificationManager::Get(); chromeos::MagnificationManager::Get();
ASSERT_TRUE(magnification_manager); ASSERT_TRUE(magnification_manager);
EXPECT_FALSE(magnification_manager->IsMagnifierEnabled()); EXPECT_FALSE(magnification_manager->IsMagnifierEnabled());
EXPECT_EQ(ash::kDefaultMagnifierType,
magnification_manager->GetMagnifierType());
} }
IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyLoginScreenBrowsertest, IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyLoginScreenBrowsertest,

@@ -200,7 +200,7 @@ void Preferences::RegisterProfilePrefs(
ash::prefs::kAccessibilityScreenMagnifierEnabled, false, ash::prefs::kAccessibilityScreenMagnifierEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterIntegerPref( registry->RegisterIntegerPref(
ash::prefs::kAccessibilityScreenMagnifierType, ash::kDefaultMagnifierType, ash::prefs::kAccessibilityScreenMagnifierType, ash::MAGNIFIER_FULL,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterDoublePref(ash::prefs::kAccessibilityScreenMagnifierScale, registry->RegisterDoublePref(ash::prefs::kAccessibilityScreenMagnifierScale,
std::numeric_limits<double>::min()); std::numeric_limits<double>::min());

@@ -1037,8 +1037,8 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildHandlerList(
handlers->AddHandler(base::MakeUnique<IntRangePolicyHandler>( handlers->AddHandler(base::MakeUnique<IntRangePolicyHandler>(
key::kUptimeLimit, prefs::kUptimeLimit, 3600, INT_MAX, true)); key::kUptimeLimit, prefs::kUptimeLimit, 3600, INT_MAX, true));
handlers->AddHandler(base::WrapUnique(new IntRangePolicyHandler( handlers->AddHandler(base::WrapUnique(new IntRangePolicyHandler(
key::kDeviceLoginScreenDefaultScreenMagnifierType, NULL, 0, key::kDeviceLoginScreenDefaultScreenMagnifierType, nullptr,
ash::MAGNIFIER_FULL, false))); ash::MAGNIFIER_DISABLED, ash::MAGNIFIER_FULL, false)));
// TODO(binjin): Remove LegacyPoliciesDeprecatingPolicyHandler for these two // TODO(binjin): Remove LegacyPoliciesDeprecatingPolicyHandler for these two
// policies once deprecation of legacy power management policies is done. // policies once deprecation of legacy power management policies is done.
// http://crbug.com/346229 // http://crbug.com/346229

@@ -2873,9 +2873,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ScreenMagnifierTypeNone) {
chromeos::MagnificationManager::Get(); chromeos::MagnificationManager::Get();
// Manually enable the full-screen magnifier. // Manually enable the full-screen magnifier.
magnification_manager->SetMagnifierType(ash::MAGNIFIER_FULL);
magnification_manager->SetMagnifierEnabled(true); magnification_manager->SetMagnifierEnabled(true);
EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType());
EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); EXPECT_TRUE(magnification_manager->IsMagnifierEnabled());
// Verify that policy overrides the manual setting. // Verify that policy overrides the manual setting.
@@ -2905,7 +2903,6 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ScreenMagnifierTypeFull) {
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
base::MakeUnique<base::Value>(ash::MAGNIFIER_FULL), nullptr); base::MakeUnique<base::Value>(ash::MAGNIFIER_FULL), nullptr);
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType());
EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); EXPECT_TRUE(magnification_manager->IsMagnifierEnabled());
// Verify that the screen magnifier cannot be disabled manually anymore. // Verify that the screen magnifier cannot be disabled manually anymore.

@@ -9,7 +9,6 @@
#include "ash/accessibility_types.h" #include "ash/accessibility_types.h"
#include "ash/high_contrast/high_contrast_controller.h" #include "ash/high_contrast/high_contrast_controller.h"
#include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/magnification_controller.h"
#include "ash/magnifier/partial_magnification_controller.h"
#include "ash/mus/bridge/shell_port_mash.h" #include "ash/mus/bridge/shell_port_mash.h"
#include "ash/mus/window_manager.h" #include "ash/mus/window_manager.h"
#include "ash/public/cpp/config.h" #include "ash/public/cpp/config.h"
@@ -123,14 +122,8 @@ AshInit::AshInit() {
chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); chromeos::AccessibilityManager::Get()->IsHighContrastEnabled());
DCHECK(chromeos::MagnificationManager::Get()); DCHECK(chromeos::MagnificationManager::Get());
bool magnifier_enabled =
chromeos::MagnificationManager::Get()->IsMagnifierEnabled();
ash::MagnifierType magnifier_type =
chromeos::MagnificationManager::Get()->GetMagnifierType();
shell->magnification_controller()->SetEnabled( shell->magnification_controller()->SetEnabled(
magnifier_enabled && magnifier_type == ash::MAGNIFIER_FULL); chromeos::MagnificationManager::Get()->IsMagnifierEnabled());
shell->partial_magnification_controller()->SetEnabled(
magnifier_enabled && magnifier_type == ash::MAGNIFIER_PARTIAL);
if (!base::CommandLine::ForCurrentProcess()->HasSwitch( if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableZeroBrowsersOpenForTests)) { switches::kDisableZeroBrowsersOpenForTests)) {

@@ -140,21 +140,11 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled); return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled);
} }
void SetMagnifierType(ash::MagnifierType type) override {
DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->SetMagnifierType(type);
}
bool IsMagnifierEnabled() const override { bool IsMagnifierEnabled() const override {
DCHECK(chromeos::MagnificationManager::Get()); DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); return chromeos::MagnificationManager::Get()->IsMagnifierEnabled();
} }
ash::MagnifierType GetMagnifierType() const override {
DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->GetMagnifierType();
}
void SetLargeCursorEnabled(bool enabled) override { void SetLargeCursorEnabled(bool enabled) override {
DCHECK(AccessibilityManager::Get()); DCHECK(AccessibilityManager::Get());
return AccessibilityManager::Get()->EnableLargeCursor(enabled); return AccessibilityManager::Get()->EnableLargeCursor(enabled);