Commit d830c09a authored by acolwell@chromium.org's avatar acolwell@chromium.org

Revert 176087

Appears to break ChromeOS browser_tests.

> 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

TBR=yoshiki@chromium.org
Review URL: https://codereview.chromium.org/11821053

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176102 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c4ac80f
...@@ -7,16 +7,12 @@ ...@@ -7,16 +7,12 @@
namespace ash { namespace ash {
// Note: Do not change these values; UMA and prefs depend on them.
enum MagnifierType { enum MagnifierType {
MAGNIFIER_FULL = 1, MAGNIFIER_OFF,
MAGNIFIER_PARTIAL = 2, MAGNIFIER_FULL,
MAGNIFIER_PARTIAL,
}; };
const int kMaxMagnifierType = 2;
const MagnifierType kDefaultMagnifierType = MAGNIFIER_FULL;
} // namespace ash } // namespace ash
#endif // ASH_MAGNIFIER_MAGNIFIER_CONSTANTS_H_ #endif // ASH_MAGNIFIER_MAGNIFIER_CONSTANTS_H_
...@@ -25,8 +25,7 @@ ShellDelegateImpl::ShellDelegateImpl() ...@@ -25,8 +25,7 @@ ShellDelegateImpl::ShellDelegateImpl()
locked_(false), locked_(false),
spoken_feedback_enabled_(false), spoken_feedback_enabled_(false),
high_contrast_enabled_(false), high_contrast_enabled_(false),
screen_magnifier_enabled_(false), screen_magnifier_type_(MAGNIFIER_OFF) {
screen_magnifier_type_(kDefaultMagnifierType) {
} }
ShellDelegateImpl::~ShellDelegateImpl() { ShellDelegateImpl::~ShellDelegateImpl() {
...@@ -135,18 +134,10 @@ bool ShellDelegateImpl::IsHighContrastEnabled() const { ...@@ -135,18 +134,10 @@ bool ShellDelegateImpl::IsHighContrastEnabled() const {
return high_contrast_enabled_; return high_contrast_enabled_;
} }
void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) { void ShellDelegateImpl::SetMagnifier(MagnifierType type) {
screen_magnifier_enabled_ = enabled;
}
void ShellDelegateImpl::SetMagnifierType(MagnifierType type) {
screen_magnifier_type_ = type; screen_magnifier_type_ = type;
} }
bool ShellDelegateImpl::IsMagnifierEnabled() const {
return screen_magnifier_enabled_;
}
MagnifierType ShellDelegateImpl::GetMagnifierType() const { MagnifierType ShellDelegateImpl::GetMagnifierType() const {
return screen_magnifier_type_; return screen_magnifier_type_;
} }
......
...@@ -46,9 +46,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { ...@@ -46,9 +46,7 @@ class ShellDelegateImpl : public ash::ShellDelegate {
virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual bool IsSpokenFeedbackEnabled() const OVERRIDE;
virtual void ToggleHighContrast() OVERRIDE; virtual void ToggleHighContrast() OVERRIDE;
virtual bool IsHighContrastEnabled() const OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE;
virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; virtual void SetMagnifier(MagnifierType type) OVERRIDE;
virtual void SetMagnifierType(MagnifierType type) OVERRIDE;
virtual bool IsMagnifierEnabled() const OVERRIDE;
virtual MagnifierType GetMagnifierType() const OVERRIDE; virtual MagnifierType GetMagnifierType() const OVERRIDE;
virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE;
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
...@@ -81,7 +79,6 @@ class ShellDelegateImpl : public ash::ShellDelegate { ...@@ -81,7 +79,6 @@ class ShellDelegateImpl : public ash::ShellDelegate {
bool locked_; bool locked_;
bool spoken_feedback_enabled_; bool spoken_feedback_enabled_;
bool high_contrast_enabled_; bool high_contrast_enabled_;
bool screen_magnifier_enabled_;
MagnifierType screen_magnifier_type_; MagnifierType screen_magnifier_type_;
DISALLOW_COPY_AND_ASSIGN(ShellDelegateImpl); DISALLOW_COPY_AND_ASSIGN(ShellDelegateImpl);
......
...@@ -149,14 +149,8 @@ class ASH_EXPORT ShellDelegate { ...@@ -149,14 +149,8 @@ class ASH_EXPORT ShellDelegate {
// Returns true if high contrast mode is enabled. // Returns true if high contrast mode is enabled.
virtual bool IsHighContrastEnabled() const = 0; virtual bool IsHighContrastEnabled() const = 0;
// Invoked to enable the screen magnifier. // Invoked to change the mode of the screen magnifier.
virtual void SetMagnifierEnabled(bool enabled) = 0; virtual void SetMagnifier(MagnifierType type) = 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. // Returns the current screen magnifier mode.
virtual MagnifierType GetMagnifierType() const = 0; virtual MagnifierType GetMagnifierType() const = 0;
......
...@@ -44,7 +44,7 @@ uint32 GetAccessibilityState() { ...@@ -44,7 +44,7 @@ uint32 GetAccessibilityState() {
state |= A11Y_SPOKEN_FEEDBACK; state |= A11Y_SPOKEN_FEEDBACK;
if (shell_delegate->IsHighContrastEnabled()) if (shell_delegate->IsHighContrastEnabled())
state |= A11Y_HIGH_CONTRAST; state |= A11Y_HIGH_CONTRAST;
if (shell_delegate->IsMagnifierEnabled()) if (shell_delegate->GetMagnifierType() != ash::MAGNIFIER_OFF)
state |= A11Y_SCREEN_MAGNIFIER; state |= A11Y_SCREEN_MAGNIFIER;
return state; return state;
} }
...@@ -138,7 +138,8 @@ void AccessibilityDetailedView::AppendAccessibilityList() { ...@@ -138,7 +138,8 @@ void AccessibilityDetailedView::AppendAccessibilityList() {
IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE), IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE),
high_contrast_enabled_ ? gfx::Font::BOLD : gfx::Font::NORMAL, high_contrast_enabled_ ? gfx::Font::BOLD : gfx::Font::NORMAL,
high_contrast_enabled_); high_contrast_enabled_);
screen_magnifier_enabled_ = shell_delegate->IsMagnifierEnabled(); screen_magnifier_enabled_ =
shell_delegate->GetMagnifierType() == ash::MAGNIFIER_FULL;
screen_magnifier_view_ = AddScrollListItem( screen_magnifier_view_ = AddScrollListItem(
bundle.GetLocalizedString( bundle.GetLocalizedString(
IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER), IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SCREEN_MAGNIFIER),
...@@ -197,7 +198,10 @@ void AccessibilityDetailedView::ClickedOn(views::View* sender) { ...@@ -197,7 +198,10 @@ void AccessibilityDetailedView::ClickedOn(views::View* sender) {
} else if (sender == high_contrast_view_) { } else if (sender == high_contrast_view_) {
shell_delegate->ToggleHighContrast(); shell_delegate->ToggleHighContrast();
} else if (sender == screen_magnifier_view_) { } 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);
} }
} }
......
...@@ -24,8 +24,7 @@ TestShellDelegate::TestShellDelegate() ...@@ -24,8 +24,7 @@ TestShellDelegate::TestShellDelegate()
session_started_(true), session_started_(true),
spoken_feedback_enabled_(false), spoken_feedback_enabled_(false),
high_contrast_enabled_(false), high_contrast_enabled_(false),
screen_magnifier_enabled_(false), screen_magnifier_type_(MAGNIFIER_OFF),
screen_magnifier_type_(kDefaultMagnifierType),
user_logged_in_(true), user_logged_in_(true),
can_lock_screen_(true), can_lock_screen_(true),
num_exit_requests_(0) { num_exit_requests_(0) {
...@@ -125,18 +124,10 @@ bool TestShellDelegate::IsHighContrastEnabled() const { ...@@ -125,18 +124,10 @@ bool TestShellDelegate::IsHighContrastEnabled() const {
return high_contrast_enabled_; return high_contrast_enabled_;
} }
void TestShellDelegate::SetMagnifierEnabled(bool enabled) { void TestShellDelegate::SetMagnifier(const MagnifierType type) {
screen_magnifier_enabled_ = enabled;
}
void TestShellDelegate::SetMagnifierType(MagnifierType type) {
screen_magnifier_type_ = type; screen_magnifier_type_ = type;
} }
bool TestShellDelegate::IsMagnifierEnabled() const {
return screen_magnifier_enabled_;
}
MagnifierType TestShellDelegate::GetMagnifierType() const { MagnifierType TestShellDelegate::GetMagnifierType() const {
return screen_magnifier_type_; return screen_magnifier_type_;
} }
......
...@@ -45,9 +45,7 @@ class TestShellDelegate : public ShellDelegate { ...@@ -45,9 +45,7 @@ class TestShellDelegate : public ShellDelegate {
virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual bool IsSpokenFeedbackEnabled() const OVERRIDE;
virtual void ToggleHighContrast() OVERRIDE; virtual void ToggleHighContrast() OVERRIDE;
virtual bool IsHighContrastEnabled() const OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE;
virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; virtual void SetMagnifier(MagnifierType type) OVERRIDE;
virtual void SetMagnifierType(MagnifierType type) OVERRIDE;
virtual bool IsMagnifierEnabled() const OVERRIDE;
virtual MagnifierType GetMagnifierType() const OVERRIDE; virtual MagnifierType GetMagnifierType() const OVERRIDE;
virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE;
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
...@@ -96,7 +94,6 @@ class TestShellDelegate : public ShellDelegate { ...@@ -96,7 +94,6 @@ class TestShellDelegate : public ShellDelegate {
bool session_started_; bool session_started_;
bool spoken_feedback_enabled_; bool spoken_feedback_enabled_;
bool high_contrast_enabled_; bool high_contrast_enabled_;
bool screen_magnifier_enabled_;
MagnifierType screen_magnifier_type_; MagnifierType screen_magnifier_type_;
bool user_logged_in_; bool user_logged_in_;
bool can_lock_screen_; bool can_lock_screen_;
......
...@@ -50,6 +50,10 @@ using content::RenderViewHost; ...@@ -50,6 +50,10 @@ using content::RenderViewHost;
namespace chromeos { namespace chromeos {
namespace accessibility { namespace accessibility {
const char kScreenMagnifierOff[] = "";
const char kScreenMagnifierFull[] = "full";
const char kScreenMagnifierPartial[] = "partial";
// Helper class that directly loads an extension's content scripts into // Helper class that directly loads an extension's content scripts into
// all of the frames corresponding to a given RenderViewHost. // all of the frames corresponding to a given RenderViewHost.
class ContentScriptLoader { class ContentScriptLoader {
...@@ -119,14 +123,10 @@ void UpdateChromeOSAccessibilityHistograms() { ...@@ -119,14 +123,10 @@ void UpdateChromeOSAccessibilityHistograms() {
IsHighContrastEnabled()); IsHighContrastEnabled());
UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard", UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard",
IsVirtualKeyboardEnabled()); IsVirtualKeyboardEnabled());
if (MagnificationManager::Get()) { if (MagnificationManager::Get())
uint32 type = MagnificationManager::Get()->IsMagnifierEnabled() ?
MagnificationManager::Get()->GetMagnifierType() : 0;
// '0' means magnifier is disabled.
UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier", UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier",
type, MagnificationManager::Get()->GetMagnifierType(),
ash::kMaxMagnifierType + 1); 3);
}
} }
void Initialize() { void Initialize() {
...@@ -290,6 +290,27 @@ bool IsVirtualKeyboardEnabled() { ...@@ -290,6 +290,27 @@ bool IsVirtualKeyboardEnabled() {
return virtual_keyboard_enabled; return virtual_keyboard_enabled;
} }
ash::MagnifierType MagnifierTypeFromName(const char type_name[]) {
if (0 == strcmp(type_name, kScreenMagnifierFull))
return ash::MAGNIFIER_FULL;
else if (0 == strcmp(type_name, kScreenMagnifierPartial))
return ash::MAGNIFIER_PARTIAL;
else
return ash::MAGNIFIER_OFF;
}
const char* ScreenMagnifierNameFromType(ash::MagnifierType type) {
switch (type) {
case ash::MAGNIFIER_OFF:
return kScreenMagnifierOff;
case ash::MAGNIFIER_FULL:
return kScreenMagnifierFull;
case ash::MAGNIFIER_PARTIAL:
return kScreenMagnifierPartial;
}
return kScreenMagnifierOff;
}
void MaybeSpeak(const std::string& utterance) { void MaybeSpeak(const std::string& utterance) {
if (IsSpokenFeedbackEnabled()) if (IsSpokenFeedbackEnabled())
Speak(utterance); Speak(utterance);
......
...@@ -24,19 +24,9 @@ struct AccessibilityStatusEventDetails { ...@@ -24,19 +24,9 @@ struct AccessibilityStatusEventDetails {
AccessibilityStatusEventDetails( AccessibilityStatusEventDetails(
bool enabled, ash::AccessibilityNotificationVisibility notify) bool enabled, ash::AccessibilityNotificationVisibility notify)
: enabled(enabled), : enabled(enabled),
magnifier_type(ash::kDefaultMagnifierType),
notify(notify) {}
AccessibilityStatusEventDetails(
bool enabled,
ash::MagnifierType magnifier_type,
ash::AccessibilityNotificationVisibility notify)
: enabled(enabled),
magnifier_type(magnifier_type),
notify(notify) {} notify(notify) {}
bool enabled; bool enabled;
ash::MagnifierType magnifier_type;
ash::AccessibilityNotificationVisibility notify; ash::AccessibilityNotificationVisibility notify;
}; };
...@@ -74,6 +64,12 @@ bool IsHighContrastEnabled(); ...@@ -74,6 +64,12 @@ bool IsHighContrastEnabled();
// Returns true if the Virtual Keyboard is enabled, or false if not. // Returns true if the Virtual Keyboard is enabled, or false if not.
bool IsVirtualKeyboardEnabled(); bool IsVirtualKeyboardEnabled();
// Translates from a string to MagnifierType.
ash::MagnifierType MagnifierTypeFromName(const char type_name[]);
// Translates from a MagnifierType to type string.
const char* ScreenMagnifierNameFromType(ash::MagnifierType type);
// Speaks 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); void MaybeSpeak(const std::string& utterance);
......
...@@ -34,8 +34,7 @@ class MagnificationManagerImpl : public MagnificationManager, ...@@ -34,8 +34,7 @@ class MagnificationManagerImpl : public MagnificationManager,
public: public:
MagnificationManagerImpl() : first_time_update_(true), MagnificationManagerImpl() : first_time_update_(true),
profile_(NULL), profile_(NULL),
type_(ash::kDefaultMagnifierType), type_(ash::MAGNIFIER_OFF) {
enabled_(false) {
registrar_.Add(this, registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_CREATED, chrome::NOTIFICATION_PROFILE_CREATED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
...@@ -55,114 +54,64 @@ class MagnificationManagerImpl : public MagnificationManager, ...@@ -55,114 +54,64 @@ class MagnificationManagerImpl : public MagnificationManager,
} }
// MagnificationManager implimentation: // MagnificationManager implimentation:
bool IsMagnifierEnabled() const OVERRIDE { ash::MagnifierType GetMagnifierType() OVERRIDE {
return enabled_;
}
ash::MagnifierType GetMagnifierType() const OVERRIDE {
return type_; return type_;
} }
void SetMagnifierEnabled(bool enabled) OVERRIDE { void SetMagnifier(ash::MagnifierType type) OVERRIDE {
// This method may be invoked even when the other magnifier settings (e.g. if (type == type_ && type == ash::MAGNIFIER_OFF)
// type or scale) are changed, so we need to call magnification controller
// even if |enabled| is unchanged. Only if |enabled| is false and the
// magnifier is already disabled, we are sure that we don't need to reflect
// the new settings right now because the magnifier keeps disabled.
if (!enabled && !enabled_)
return; return;
enabled_ = enabled; type_ = type;
if (profile_) { if (profile_) {
PrefService* prefs = profile_->GetPrefs(); PrefService* prefs = profile_->GetPrefs();
DCHECK(prefs); if (prefs) {
bool enabled = (type != ash::MAGNIFIER_OFF);
if (enabled != prefs->GetBoolean(prefs::kScreenMagnifierEnabled)) { if (enabled != prefs->GetBoolean(prefs::kScreenMagnifierEnabled)) {
prefs->SetBoolean(prefs::kScreenMagnifierEnabled, enabled); prefs->SetBoolean(prefs::kScreenMagnifierEnabled, enabled);
prefs->CommitPendingWrite(); prefs->CommitPendingWrite();
} }
} }
NotifyMagnifierChanged();
if (type_ == ash::MAGNIFIER_FULL) {
ash::Shell::GetInstance()->magnification_controller()->SetEnabled(
enabled_);
} else {
ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
enabled_);
}
} }
void SetMagnifierType(ash::MagnifierType type) OVERRIDE { accessibility::AccessibilityStatusEventDetails details(
if (type_ == type) type != ash::MAGNIFIER_OFF, ash::A11Y_NOTIFICATION_NONE);
return; content::NotificationService::current()->Notify(
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER,
DCHECK(type == ash::MAGNIFIER_FULL || type == ash::MAGNIFIER_PARTIAL); content::NotificationService::AllSources(),
type_ = type; content::Details<accessibility::AccessibilityStatusEventDetails>(
&details));
if (profile_) {
PrefService* prefs = profile_->GetPrefs();
DCHECK(prefs);
prefs->SetInteger(prefs::kScreenMagnifierType, type);
prefs->CommitPendingWrite();
}
NotifyMagnifierChanged();
if (enabled_) {
ash::Shell::GetInstance()->magnification_controller()->SetEnabled( ash::Shell::GetInstance()->magnification_controller()->SetEnabled(
type_ == ash::MAGNIFIER_FULL); type == ash::MAGNIFIER_FULL);
ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled( ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
type_ == ash::MAGNIFIER_PARTIAL); type == ash::MAGNIFIER_PARTIAL);
}
} }
void SaveScreenMagnifierScale(double scale) OVERRIDE { void SaveScreenMagnifierScale(double scale) OVERRIDE {
Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
DCHECK(profile->GetPrefs());
profile->GetPrefs()->SetDouble(prefs::kScreenMagnifierScale, scale); profile->GetPrefs()->SetDouble(prefs::kScreenMagnifierScale, scale);
} }
double GetSavedScreenMagnifierScale() const OVERRIDE { double GetSavedScreenMagnifierScale() OVERRIDE {
Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
DCHECK(profile->GetPrefs());
if (profile->GetPrefs()->HasPrefPath(prefs::kScreenMagnifierScale)) if (profile->GetPrefs()->HasPrefPath(prefs::kScreenMagnifierScale))
return profile->GetPrefs()->GetDouble(prefs::kScreenMagnifierScale); return profile->GetPrefs()->GetDouble(prefs::kScreenMagnifierScale);
return std::numeric_limits<double>::min(); return std::numeric_limits<double>::min();
} }
private: private:
void NotifyMagnifierChanged() {
accessibility::AccessibilityStatusEventDetails details(
enabled_, type_, ash::A11Y_NOTIFICATION_NONE);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER,
content::NotificationService::AllSources(),
content::Details<accessibility::AccessibilityStatusEventDetails>(
&details));
}
bool IsMagnifierEnabledFromPref() {
if (!profile_)
return false;
DCHECK(profile_->GetPrefs());
return profile_->GetPrefs()->GetBoolean(prefs::kScreenMagnifierEnabled);
}
ash::MagnifierType GetMagnifierTypeFromPref() { ash::MagnifierType GetMagnifierTypeFromPref() {
if (!profile_) if (!profile_)
return ash::kDefaultMagnifierType; return ash::MAGNIFIER_OFF;
DCHECK(profile_->GetPrefs()); PrefService* prefs = profile_->GetPrefs();
ash::MagnifierType type = static_cast<ash::MagnifierType>( if (!prefs)
profile_->GetPrefs()->GetInteger(prefs::kScreenMagnifierType)); return ash::MAGNIFIER_OFF;
if (type == ash::MAGNIFIER_FULL || type == ash::MAGNIFIER_PARTIAL)
return type;
return ash::kDefaultMagnifierType; return prefs->GetBoolean(prefs::kScreenMagnifierEnabled) ?
ash::MAGNIFIER_FULL : ash::MAGNIFIER_OFF;
} }
void SetProfile(Profile* profile) { void SetProfile(Profile* profile) {
...@@ -175,27 +124,17 @@ class MagnificationManagerImpl : public MagnificationManager, ...@@ -175,27 +124,17 @@ class MagnificationManagerImpl : public MagnificationManager,
pref_change_registrar_->Init(profile->GetPrefs()); pref_change_registrar_->Init(profile->GetPrefs());
pref_change_registrar_->Add( pref_change_registrar_->Add(
prefs::kScreenMagnifierEnabled, prefs::kScreenMagnifierEnabled,
base::Bind(&MagnificationManagerImpl::UpdateMagnifierStatusFromPref, base::Bind(&MagnificationManagerImpl::UpdateMagnifierStatus,
base::Unretained(this)));
pref_change_registrar_->Add(
prefs::kScreenMagnifierType,
base::Bind(&MagnificationManagerImpl::UpdateMagnifierStatusFromPref,
base::Unretained(this))); base::Unretained(this)));
} }
profile_ = profile; profile_ = profile;
UpdateMagnifierStatusFromPref(); UpdateMagnifierStatus();
} }
void UpdateMagnifierStatusFromPref() { void UpdateMagnifierStatus() {
bool enabled = IsMagnifierEnabledFromPref(); ash::MagnifierType type = GetMagnifierTypeFromPref();
if (!enabled) { SetMagnifier(type);
SetMagnifierEnabled(enabled);
SetMagnifierType(GetMagnifierTypeFromPref());
} else {
SetMagnifierType(GetMagnifierTypeFromPref());
SetMagnifierEnabled(enabled);
}
} }
// content::NotificationObserver implimentation: // content::NotificationObserver implimentation:
...@@ -229,7 +168,6 @@ class MagnificationManagerImpl : public MagnificationManager, ...@@ -229,7 +168,6 @@ class MagnificationManagerImpl : public MagnificationManager,
bool first_time_update_; bool first_time_update_;
Profile* profile_; Profile* profile_;
ash::MagnifierType type_; ash::MagnifierType type_;
bool enabled_;
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
......
...@@ -24,30 +24,20 @@ class MagnificationManager { ...@@ -24,30 +24,20 @@ class MagnificationManager {
// Returns the existing instance. If there is no instance, creates one. // Returns the existing instance. If there is no instance, creates one.
// because only one instance should exist at the same time. // 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.
static void Shutdown(); static void Shutdown();
// Returns the existing instance. If there is no instance, returns NULL. // Returns the existing instance. If there is no instance, returns NULL.
static MagnificationManager* Get(); static MagnificationManager* Get();
// Returns if the screen magnifier is enabled.
virtual bool IsMagnifierEnabled() const = 0;
// Returns the current type of the screen magnifier. // Returns the current type of the screen magnifier.
virtual ash::MagnifierType GetMagnifierType() const = 0; virtual ash::MagnifierType GetMagnifierType() = 0;
// Enables the screen magnifier.
virtual void SetMagnifierEnabled(bool enabled) = 0;
// Changes the type of the screen magnifier. // Changes the type of the screen magnifier.
virtual void SetMagnifierType(ash::MagnifierType type) = 0; virtual void SetMagnifier(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;
// Loads the magnifier scale from the pref. // Loads the magnifier scale from the pref.
virtual double GetSavedScreenMagnifierScale() const = 0; virtual double GetSavedScreenMagnifierScale() = 0;
protected: protected:
virtual ~MagnificationManager() {} virtual ~MagnificationManager() {}
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/preferences.h" #include "chrome/browser/chromeos/preferences.h"
#include "ash/magnifier/magnifier_constants.h"
#include "base/chromeos/chromeos_version.h" #include "base/chromeos/chromeos_version.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/i18n/time_formatting.h" #include "base/i18n/time_formatting.h"
...@@ -14,7 +13,6 @@ ...@@ -14,7 +13,6 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/drive/drive_file_system_util.h" #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
#include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h"
...@@ -116,9 +114,6 @@ void Preferences::RegisterUserPrefs(PrefServiceSyncable* prefs) { ...@@ -116,9 +114,6 @@ void Preferences::RegisterUserPrefs(PrefServiceSyncable* prefs) {
prefs->RegisterBooleanPref(prefs::kScreenMagnifierEnabled, prefs->RegisterBooleanPref(prefs::kScreenMagnifierEnabled,
false, false,
PrefServiceSyncable::SYNCABLE_PREF); PrefServiceSyncable::SYNCABLE_PREF);
prefs->RegisterIntegerPref(prefs::kScreenMagnifierType,
ash::kDefaultMagnifierType,
PrefServiceSyncable::SYNCABLE_PREF);
prefs->RegisterDoublePref(prefs::kScreenMagnifierScale, prefs->RegisterDoublePref(prefs::kScreenMagnifierScale,
std::numeric_limits<double>::min(), std::numeric_limits<double>::min(),
PrefServiceSyncable::UNSYNCABLE_PREF); PrefServiceSyncable::UNSYNCABLE_PREF);
...@@ -309,7 +304,6 @@ void Preferences::InitUserPrefs(PrefServiceSyncable* prefs) { ...@@ -309,7 +304,6 @@ void Preferences::InitUserPrefs(PrefServiceSyncable* prefs) {
accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, callback); accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, prefs, callback);
screen_magnifier_enabled_.Init(prefs::kScreenMagnifierEnabled, screen_magnifier_enabled_.Init(prefs::kScreenMagnifierEnabled,
prefs, callback); prefs, callback);
screen_magnifier_type_.Init(prefs::kScreenMagnifierType, prefs, callback);
screen_magnifier_scale_.Init(prefs::kScreenMagnifierScale, prefs, callback); screen_magnifier_scale_.Init(prefs::kScreenMagnifierScale, prefs, callback);
mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, callback); mouse_sensitivity_.Init(prefs::kMouseSensitivity, prefs, callback);
touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, callback); touchpad_sensitivity_.Init(prefs::kTouchpadSensitivity, prefs, callback);
......
...@@ -111,7 +111,6 @@ class Preferences : public PrefServiceObserver { ...@@ -111,7 +111,6 @@ class Preferences : public PrefServiceObserver {
BooleanPrefMember vert_edge_scroll_enabled_; BooleanPrefMember vert_edge_scroll_enabled_;
BooleanPrefMember accessibility_enabled_; BooleanPrefMember accessibility_enabled_;
BooleanPrefMember screen_magnifier_enabled_; BooleanPrefMember screen_magnifier_enabled_;
IntegerPrefMember screen_magnifier_type_;
DoublePrefMember screen_magnifier_scale_; DoublePrefMember screen_magnifier_scale_;
IntegerPrefMember speed_factor_; IntegerPrefMember speed_factor_;
IntegerPrefMember mouse_sensitivity_; IntegerPrefMember mouse_sensitivity_;
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
namespace chromeos { namespace chromeos {
void SetMagnifierEnabled(bool enabled) { namespace {
MagnificationManager::Get()->SetMagnifierEnabled(enabled); ui::MouseEvent& dummyEvent = *((ui::MouseEvent*)0);
} }
class TrayAccessibilityTest : public CrosInProcessBrowserTest { class TrayAccessibilityTest : public CrosInProcessBrowserTest {
...@@ -150,13 +150,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) { ...@@ -150,13 +150,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) {
EXPECT_FALSE(IsTrayIconVisible()); EXPECT_FALSE(IsTrayIconVisible());
// Toggling magnifier the visibillity of the icon. // Toggling magnifier the visibillity of the icon.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(IsTrayIconVisible()); EXPECT_TRUE(IsTrayIconVisible());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_FALSE(IsTrayIconVisible()); EXPECT_FALSE(IsTrayIconVisible());
// Enabling all accessibility features. // Enabling all accessibility features.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(IsTrayIconVisible()); EXPECT_TRUE(IsTrayIconVisible());
accessibility::EnableHighContrast(true); accessibility::EnableHighContrast(true);
EXPECT_TRUE(IsTrayIconVisible()); EXPECT_TRUE(IsTrayIconVisible());
...@@ -166,7 +166,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) { ...@@ -166,7 +166,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) {
EXPECT_TRUE(IsTrayIconVisible()); EXPECT_TRUE(IsTrayIconVisible());
accessibility::EnableHighContrast(false); accessibility::EnableHighContrast(false);
EXPECT_TRUE(IsTrayIconVisible()); EXPECT_TRUE(IsTrayIconVisible());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_FALSE(IsTrayIconVisible()); EXPECT_FALSE(IsTrayIconVisible());
// Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
...@@ -208,13 +208,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { ...@@ -208,13 +208,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) {
EXPECT_FALSE(CanCreateMenuItem()); EXPECT_FALSE(CanCreateMenuItem());
// Toggling screen magnifier changes the visibillity of the menu. // Toggling screen magnifier changes the visibillity of the menu.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_FALSE(CanCreateMenuItem()); EXPECT_FALSE(CanCreateMenuItem());
// Enabling all accessibility features. // Enabling all accessibility features.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
accessibility::EnableHighContrast(true); accessibility::EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
...@@ -224,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { ...@@ -224,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) {
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
accessibility::EnableHighContrast(false); accessibility::EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_FALSE(CanCreateMenuItem()); EXPECT_FALSE(CanCreateMenuItem());
} }
...@@ -255,13 +255,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { ...@@ -255,13 +255,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling screen magnifier. // The menu is keeping visible regardless of toggling screen magnifier.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
// Enabling all accessibility features. // Enabling all accessibility features.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
accessibility::EnableHighContrast(true); accessibility::EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
...@@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { ...@@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
accessibility::EnableHighContrast(false); accessibility::EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
// Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true.
...@@ -300,13 +300,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { ...@@ -300,13 +300,13 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling screen magnifier. // The menu is keeping visible regardless of toggling screen magnifier.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
// Enabling all accessibility features. // Enabling all accessibility features.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
accessibility::EnableHighContrast(true); accessibility::EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
...@@ -316,7 +316,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { ...@@ -316,7 +316,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
accessibility::EnableHighContrast(false); accessibility::EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_TRUE(CanCreateMenuItem()); EXPECT_TRUE(CanCreateMenuItem());
// Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true.
...@@ -362,14 +362,17 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ClickDetailMenu) { ...@@ -362,14 +362,17 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ClickDetailMenu) {
// Confirms that the check item toggles the magnifier. // Confirms that the check item toggles the magnifier.
EXPECT_FALSE(accessibility::IsHighContrastEnabled()); EXPECT_FALSE(accessibility::IsHighContrastEnabled());
EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); EXPECT_EQ(ash::MAGNIFIER_OFF,
MagnificationManager::Get()->GetMagnifierType());
EXPECT_TRUE(CreateDetailedMenu()); EXPECT_TRUE(CreateDetailedMenu());
ClickScreenMagnifierOnDetailMenu(); ClickScreenMagnifierOnDetailMenu();
EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); EXPECT_EQ(ash::MAGNIFIER_FULL,
MagnificationManager::Get()->GetMagnifierType());
EXPECT_TRUE(CreateDetailedMenu()); EXPECT_TRUE(CreateDetailedMenu());
ClickScreenMagnifierOnDetailMenu(); ClickScreenMagnifierOnDetailMenu();
EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); EXPECT_EQ(ash::MAGNIFIER_OFF,
MagnificationManager::Get()->GetMagnifierType());
} }
IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
...@@ -413,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { ...@@ -413,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu(); CloseDetailMenu();
// Enabling full screen magnifier. // Enabling full screen magnifier.
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CreateDetailedMenu()); EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
...@@ -421,7 +424,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { ...@@ -421,7 +424,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu(); CloseDetailMenu();
// Disabling screen magnifier. // Disabling screen magnifier.
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_TRUE(CreateDetailedMenu()); EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
...@@ -431,7 +434,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { ...@@ -431,7 +434,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
// Enabling all of the a11y features. // Enabling all of the a11y features.
accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
accessibility::EnableHighContrast(true); accessibility::EnableHighContrast(true);
SetMagnifierEnabled(true); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL);
EXPECT_TRUE(CreateDetailedMenu()); EXPECT_TRUE(CreateDetailedMenu());
EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
...@@ -441,7 +444,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { ...@@ -441,7 +444,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
// Disabling all of the a11y features. // Disabling all of the a11y features.
accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
accessibility::EnableHighContrast(false); accessibility::EnableHighContrast(false);
SetMagnifierEnabled(false); MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF);
EXPECT_TRUE(CreateDetailedMenu()); EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
......
...@@ -637,10 +637,6 @@ ...@@ -637,10 +637,6 @@
pref="settings.a11y.screen_magnifier" type="checkbox"> pref="settings.a11y.screen_magnifier" type="checkbox">
<span i18n-content="accessibilityScreenMagnifier"></span> <span i18n-content="accessibilityScreenMagnifier"></span>
</label> </label>
<select id="accessibility-screen-magnifier-type-select"
class="control" i18n-options="magnifierList" data-type="number"
pref="settings.a11y.screen_magnifier_type2">
</select>
</div> </div>
</div> </div>
<div class="option-name" id="accessibility-tap-dragging"> <div class="option-name" id="accessibility-tap-dragging">
......
...@@ -96,14 +96,12 @@ void OpenAsh() { ...@@ -96,14 +96,12 @@ void OpenAsh() {
chromeos::accessibility::IsHighContrastEnabled()); chromeos::accessibility::IsHighContrastEnabled());
DCHECK(chromeos::MagnificationManager::Get()); DCHECK(chromeos::MagnificationManager::Get());
bool magnifier_enabled =
chromeos::MagnificationManager::Get()->IsMagnifierEnabled();
ash::MagnifierType magnifier_type = ash::MagnifierType magnifier_type =
chromeos::MagnificationManager::Get()->GetMagnifierType(); chromeos::MagnificationManager::Get()->GetMagnifierType();
ash::Shell::GetInstance()->magnification_controller()-> ash::Shell::GetInstance()->magnification_controller()->SetEnabled(
SetEnabled(magnifier_enabled && magnifier_type == ash::MAGNIFIER_FULL); magnifier_type == ash::MAGNIFIER_FULL);
ash::Shell::GetInstance()->partial_magnification_controller()-> ash::Shell::GetInstance()->partial_magnification_controller()->SetEnabled(
SetEnabled(magnifier_enabled && magnifier_type == ash::MAGNIFIER_PARTIAL); magnifier_type == ash::MAGNIFIER_PARTIAL);
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableZeroBrowsersOpenForTests)) { switches::kDisableZeroBrowsersOpenForTests)) {
......
...@@ -355,35 +355,19 @@ void ChromeShellDelegate::ToggleHighContrast() { ...@@ -355,35 +355,19 @@ void ChromeShellDelegate::ToggleHighContrast() {
#endif #endif
} }
bool ChromeShellDelegate::IsMagnifierEnabled() const {
#if defined(OS_CHROMEOS)
DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->IsMagnifierEnabled();
#else
return false;
#endif
}
ash::MagnifierType ChromeShellDelegate::GetMagnifierType() const { ash::MagnifierType ChromeShellDelegate::GetMagnifierType() const {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
DCHECK(chromeos::MagnificationManager::Get()); DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->GetMagnifierType(); return chromeos::MagnificationManager::Get()->GetMagnifierType();
#else #else
return ash::kDefaultMagnifierType; return ash::MAGNIFIER_OFF;
#endif
}
void ChromeShellDelegate::SetMagnifierEnabled(bool enabled) {
#if defined(OS_CHROMEOS)
DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled);
#endif #endif
} }
void ChromeShellDelegate::SetMagnifierType(ash::MagnifierType type) { void ChromeShellDelegate::SetMagnifier(ash::MagnifierType type) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
DCHECK(chromeos::MagnificationManager::Get()); DCHECK(chromeos::MagnificationManager::Get());
return chromeos::MagnificationManager::Get()->SetMagnifierType(type); return chromeos::MagnificationManager::Get()->SetMagnifier(type);
#endif #endif
} }
......
...@@ -61,9 +61,7 @@ class ChromeShellDelegate : public ash::ShellDelegate, ...@@ -61,9 +61,7 @@ class ChromeShellDelegate : public ash::ShellDelegate,
virtual void ToggleSpokenFeedback( virtual void ToggleSpokenFeedback(
ash::AccessibilityNotificationVisibility notify) OVERRIDE; ash::AccessibilityNotificationVisibility notify) OVERRIDE;
virtual bool IsHighContrastEnabled() const OVERRIDE; virtual bool IsHighContrastEnabled() const OVERRIDE;
virtual void SetMagnifierEnabled(bool enabled) OVERRIDE; virtual void SetMagnifier(ash::MagnifierType type) OVERRIDE;
virtual void SetMagnifierType(ash::MagnifierType type) OVERRIDE;
virtual bool IsMagnifierEnabled() const OVERRIDE;
virtual ash::MagnifierType GetMagnifierType() const OVERRIDE; virtual ash::MagnifierType GetMagnifierType() const OVERRIDE;
virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE;
virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
......
...@@ -149,8 +149,10 @@ void CoreOobeHandler::HandleEnableScreenMagnifier(const base::ListValue* args) { ...@@ -149,8 +149,10 @@ void CoreOobeHandler::HandleEnableScreenMagnifier(const base::ListValue* args) {
return; return;
} }
// TODO(nkostylev): Add support for partial screen magnifier. // TODO(nkostylev): Add support for partial screen magnifier.
ash::MagnifierType type = enabled ? ash::MAGNIFIER_FULL :
ash::MAGNIFIER_OFF;
DCHECK(MagnificationManager::Get()); DCHECK(MagnificationManager::Get());
MagnificationManager::Get()->SetMagnifierEnabled(enabled); MagnificationManager::Get()->SetMagnifier(type);
} }
void CoreOobeHandler::HandleEnableSpokenFeedback(const base::ListValue* args) { void CoreOobeHandler::HandleEnableSpokenFeedback(const base::ListValue* args) {
...@@ -171,13 +173,15 @@ void CoreOobeHandler::ShowOobeUI(bool show) { ...@@ -171,13 +173,15 @@ void CoreOobeHandler::ShowOobeUI(bool show) {
void CoreOobeHandler::UpdateA11yState() { void CoreOobeHandler::UpdateA11yState() {
DCHECK(MagnificationManager::Get()); DCHECK(MagnificationManager::Get());
ash::MagnifierType type = MagnificationManager::Get()->GetMagnifierType();
base::DictionaryValue a11y_info; base::DictionaryValue a11y_info;
a11y_info.SetBoolean("highContrastEnabled", a11y_info.SetBoolean("highContrastEnabled",
accessibility::IsHighContrastEnabled()); accessibility::IsHighContrastEnabled());
a11y_info.SetBoolean("spokenFeedbackEnabled", a11y_info.SetBoolean("spokenFeedbackEnabled",
accessibility::IsSpokenFeedbackEnabled()); accessibility::IsSpokenFeedbackEnabled());
a11y_info.SetBoolean("screenMagnifierEnabled", a11y_info.SetBoolean("screenMagnifierEnabled",
MagnificationManager::Get()->IsMagnifierEnabled()); type != ash::MAGNIFIER_OFF);
web_ui()->CallJavascriptFunction("cr.ui.Oobe.refreshA11yInfo", a11y_info); web_ui()->CallJavascriptFunction("cr.ui.Oobe.refreshA11yInfo", a11y_info);
} }
......
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
#endif #endif
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "ash/magnifier/magnifier_constants.h"
#include "chrome/browser/chromeos/accessibility/accessibility_util.h" #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
#include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h"
#include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/login/user_manager.h"
...@@ -424,22 +423,6 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) { ...@@ -424,22 +423,6 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
values->SetString("accessibilityLearnMoreURL", values->SetString("accessibilityLearnMoreURL",
chrome::kChromeAccessibilityHelpURL); chrome::kChromeAccessibilityHelpURL);
// Creates magnifierList.
base::ListValue* magnifierList = new base::ListValue();
base::ListValue* option_full = new base::ListValue();
option_full->Append(base::Value::CreateIntegerValue(ash::MAGNIFIER_FULL));
option_full->Append(new base::StringValue(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL)));
base::ListValue* option_partial = new base::ListValue();
option_partial->Append(base::Value::CreateIntegerValue(
ash::MAGNIFIER_PARTIAL));
option_partial->Append(new base::StringValue(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL)));
magnifierList->Append(option_full);
magnifierList->Append(option_partial);
values->Set("magnifierList", magnifierList);
#endif #endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
values->SetString("macPasswordsWarning", values->SetString("macPasswordsWarning",
......
...@@ -743,10 +743,6 @@ const char kSpokenFeedbackEnabled[] = "settings.accessibility"; ...@@ -743,10 +743,6 @@ const char kSpokenFeedbackEnabled[] = "settings.accessibility";
const char kHighContrastEnabled[] = "settings.a11y.high_contrast_enabled"; const char kHighContrastEnabled[] = "settings.a11y.high_contrast_enabled";
// A boolean pref which determines whether screen magnifier is enabled. // A boolean pref which determines whether screen magnifier is enabled.
const char kScreenMagnifierEnabled[] = "settings.a11y.screen_magnifier"; const char kScreenMagnifierEnabled[] = "settings.a11y.screen_magnifier";
// A integer pref which determines what type of screen magnifier is enabled.
// Note that: 'screen_magnifier_type' had been used as string pref. Hence,
// we are using another name pref here.
const char kScreenMagnifierType[] = "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.
const char kScreenMagnifierScale[] = "settings.a11y.screen_magnifier_scale"; const char kScreenMagnifierScale[] = "settings.a11y.screen_magnifier_scale";
// A boolean pref which determines whether virtual keyboard is enabled. // A boolean pref which determines whether virtual keyboard is enabled.
......
...@@ -271,7 +271,6 @@ extern const char kLanguageXkbAutoRepeatInterval[]; ...@@ -271,7 +271,6 @@ extern const char kLanguageXkbAutoRepeatInterval[];
extern const char kSpokenFeedbackEnabled[]; extern const char kSpokenFeedbackEnabled[];
extern const char kHighContrastEnabled[]; extern const char kHighContrastEnabled[];
extern const char kScreenMagnifierEnabled[]; extern const char kScreenMagnifierEnabled[];
extern const char kScreenMagnifierType[];
extern const char kScreenMagnifierScale[]; extern const char kScreenMagnifierScale[];
extern const char kVirtualKeyboardEnabled[]; extern const char kVirtualKeyboardEnabled[];
extern const char kShouldAlwaysShowAccessibilityMenu[]; extern const char kShouldAlwaysShowAccessibilityMenu[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment