Skip to content

Commit

Permalink
Revert 247420 "Add a11y on-screen keyboard."
Browse files Browse the repository at this point in the history
Suspected of breaking ChromeOS ASan:
http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20%28valgrind%29%285%29/builds/25099/steps/memory%20test%3A%20unit/logs/stdio


> Add a11y on-screen keyboard.
> 
> Adds an accessibility option for displaying a virtual keyboard on the login screen and on the settings page.
> 
> Followup patches required to persist the login preference on first time sign in, and to use the full virtual keyboard in place of the touch optimized version. 
> 
> BUG=297132
> 
> Review URL: https://codereview.chromium.org/137543002

TBR=kevers@chromium.org

Review URL: https://codereview.chromium.org/137023009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247448 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
eugenis@chromium.org committed Jan 28, 2014
1 parent a7df32f commit b1ce2d4
Show file tree
Hide file tree
Showing 28 changed files with 32 additions and 276 deletions.
3 changes: 0 additions & 3 deletions ash/accessibility_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ class ASH_EXPORT AccessibilityDelegate {
// Returns if autoclick is enabled or not.
virtual bool IsAutoclickEnabled() const = 0;

// Returns if the a11y virtual keyboard is enabled.
virtual bool IsVirtualKeyboardEnabled() const = 0;

// Returns true when the accessibility menu should be shown.
virtual bool ShouldShowAccessibilityMenu() const = 0;

Expand Down
4 changes: 0 additions & 4 deletions ash/default_accessibility_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ bool DefaultAccessibilityDelegate::IsAutoclickEnabled() const {
return autoclick_enabled_;
}

bool DefaultAccessibilityDelegate::IsVirtualKeyboardEnabled() const {
return false;
}

bool DefaultAccessibilityDelegate::ShouldShowAccessibilityMenu() const {
return spoken_feedback_enabled_ ||
high_contrast_enabled_ ||
Expand Down
1 change: 0 additions & 1 deletion ash/default_accessibility_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate {
virtual bool IsLargeCursorEnabled() const OVERRIDE;
virtual void SetAutoclickEnabled(bool enabled) OVERRIDE;
virtual bool IsAutoclickEnabled() const OVERRIDE;
virtual bool IsVirtualKeyboardEnabled() const OVERRIDE;
virtual bool ShouldShowAccessibilityMenu() const OVERRIDE;
virtual void SilenceSpokenFeedback() const OVERRIDE;
virtual void ToggleSpokenFeedback(
Expand Down
9 changes: 6 additions & 3 deletions ash/root_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,13 @@ void RootWindowController::ActivateKeyboard(

void RootWindowController::DeactivateKeyboard(
keyboard::KeyboardController* keyboard_controller) {
if (!keyboard_controller ||
!keyboard_controller->keyboard_container_initialized()) {
if (!keyboard::IsKeyboardEnabled())
return;
}

DCHECK(keyboard_controller);
if (!keyboard_controller->keyboard_container_initialized())
return;

aura::Window* keyboard_container =
keyboard_controller->GetContainerWindow();
if (keyboard_container->GetRootWindow() == root_window()) {
Expand Down
14 changes: 1 addition & 13 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,6 @@ void Shell::CreateKeyboard() {
}
}

void Shell::DeactivateKeyboard() {
if (keyboard_controller_.get()) {
RootWindowControllerList controllers = GetAllRootWindowControllers();
for (RootWindowControllerList::iterator iter = controllers.begin();
iter != controllers.end(); ++iter) {
(*iter)->DeactivateKeyboard(keyboard_controller_.get());
}
}
keyboard_controller_.reset();
}

void Shell::ShowShelf() {
RootWindowControllerList controllers = GetAllRootWindowControllers();
for (RootWindowControllerList::iterator iter = controllers.begin();
Expand Down Expand Up @@ -871,9 +860,8 @@ void Shell::Init() {

// The keyboard system must be initialized before the RootWindowController is
// created.
#if defined(OS_CHROMEOS)
if (keyboard::IsKeyboardEnabled())
keyboard::InitializeKeyboard();
#endif

lock_state_controller_.reset(new LockStateController);
power_button_controller_.reset(new PowerButtonController(
Expand Down
7 changes: 2 additions & 5 deletions ash/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,10 @@ class ASH_EXPORT Shell
// Initializes |shelf_|. Does nothing if it's already initialized.
void CreateShelf();

// Creates a virtual keyboard. Deletes the old virtual keyboard if it already
// exists.
// Creates virtual keyboard. Deletes the old virtual keyboard if it's already
// exist.
void CreateKeyboard();

// Deactivates the virtual keyboard.
void DeactivateKeyboard();

// Show shelf view if it was created hidden (before session has started).
void ShowShelf();

Expand Down
3 changes: 0 additions & 3 deletions ash/system/tray_accessibility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ enum AccessibilityState {
A11Y_SCREEN_MAGNIFIER = 1 << 2,
A11Y_LARGE_CURSOR = 1 << 3,
A11Y_AUTOCLICK = 1 << 4,
A11Y_VIRTUAL_KEYBOARD = 1 << 5,
};

uint32 GetAccessibilityState() {
Expand All @@ -55,8 +54,6 @@ uint32 GetAccessibilityState() {
state |= A11Y_LARGE_CURSOR;
if (delegate->IsAutoclickEnabled())
state |= A11Y_AUTOCLICK;
if (delegate->IsVirtualKeyboardEnabled())
state |= A11Y_VIRTUAL_KEYBOARD;
return state;
}

Expand Down
5 changes: 1 addition & 4 deletions chrome/app/chromeos_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,6 @@ Press any key to continue exploring.
<message name="IDS_OOBE_SCREEN_MAGNIFIER_OPTION" desc="Screen magnifier option shown on OOBE screens accessibility menu.">
Screen magnifier
</message>
<message name="IDS_OOBE_VIRTUAL_KEYBOARD_OPTION" desc="Virtual keyboard option shown on the OOBE screens accessibility menu.">
On-screen keyboard
</message>
<message name="IDS_LOGIN_TITLE" desc="Title of sign in box">
Sign in
</message>
Expand Down Expand Up @@ -1850,7 +1847,7 @@ Press any key to continue exploring.
Enable tap dragging
</message>
<message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for virtual keyboard.">
Enable on-screen keyboard
Enable virtual keyboard
</message>
<message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SHOULD_ALWAYS_SHOW_MENU" desc="In the settings tab, the text next to the checkbox to show the accessibility tray menu regardless of the state of a11y features.">
Show accessibility options in the system menu
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/chrome_notification_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -866,9 +866,6 @@ enum NotificationType {
// Sent when spoken feedback is toggled.
NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK,

// Sent when a11y on-screen keyboard is toggled.
NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD,

#endif

#if defined(TOOLKIT_VIEWS)
Expand Down
53 changes: 2 additions & 51 deletions chrome/browser/chromeos/accessibility/accessibility_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
#include "media/audio/sounds/sounds_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/keyboard/keyboard_controller.h"
#include "ui/keyboard/keyboard_util.h"

using content::BrowserThread;
using content::RenderViewHost;
Expand Down Expand Up @@ -298,14 +296,12 @@ AccessibilityManager::AccessibilityManager()
high_contrast_pref_handler_(prefs::kHighContrastEnabled),
autoclick_pref_handler_(prefs::kAutoclickEnabled),
autoclick_delay_pref_handler_(prefs::kAutoclickDelayMs),
virtual_keyboard_pref_handler_(prefs::kVirtualKeyboardEnabled),
large_cursor_enabled_(false),
sticky_keys_enabled_(false),
spoken_feedback_enabled_(false),
high_contrast_enabled_(false),
autoclick_enabled_(false),
autoclick_delay_ms_(ash::AutoclickController::kDefaultAutoclickDelayMs),
virtual_keyboard_enabled_(false),
spoken_feedback_notification_(ash::A11Y_NOTIFICATION_NONE),
weak_ptr_factory_(this),
should_speak_chrome_vox_announcements_on_user_screen_(true),
Expand Down Expand Up @@ -371,8 +367,7 @@ bool AccessibilityManager::ShouldShowAccessibilityMenu() {
pref_service->GetBoolean(prefs::kHighContrastEnabled) ||
pref_service->GetBoolean(prefs::kAutoclickEnabled) ||
pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu) ||
pref_service->GetBoolean(prefs::kScreenMagnifierEnabled) ||
pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled))
pref_service->GetBoolean(prefs::kScreenMagnifierEnabled))
return true;
}
return false;
Expand Down Expand Up @@ -686,45 +681,6 @@ void AccessibilityManager::UpdateAutoclickDelayFromPref() {
#endif
}

void AccessibilityManager::EnableVirtualKeyboard(bool enabled) {
if (!profile_)
return;

PrefService* pref_service = profile_->GetPrefs();
pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled);
pref_service->CommitPendingWrite();
}

bool AccessibilityManager::IsVirtualKeyboardEnabled() {
return virtual_keyboard_enabled_;
}

void AccessibilityManager::UpdateVirtualKeyboardFromPref() {
if (!profile_)
return;

const bool enabled =
profile_->GetPrefs()->GetBoolean(prefs::kVirtualKeyboardEnabled);

if (virtual_keyboard_enabled_ == enabled)
return;
virtual_keyboard_enabled_ = enabled;

AccessibilityStatusEventDetails detail(enabled, ash::A11Y_NOTIFICATION_NONE);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD,
content::NotificationService::AllSources(),
content::Details<AccessibilityStatusEventDetails>(&detail));

#if defined(USE_ASH)
keyboard::SetAccessibilityKeyboardEnabled(enabled);
if (enabled)
ash::Shell::GetInstance()->CreateKeyboard();
else if (!keyboard::IsKeyboardEnabled())
ash::Shell::GetInstance()->DeactivateKeyboard();
#endif
}

void AccessibilityManager::CheckBrailleState() {
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::IO, FROM_HERE, base::Bind(
Expand Down Expand Up @@ -772,10 +728,6 @@ void AccessibilityManager::SetProfile(Profile* profile) {
prefs::kAutoclickDelayMs,
base::Bind(&AccessibilityManager::UpdateAutoclickDelayFromPref,
base::Unretained(this)));
pref_change_registrar_->Add(
prefs::kVirtualKeyboardEnabled,
base::Bind(&AccessibilityManager::UpdateVirtualKeyboardFromPref,
base::Unretained(this)));

local_state_pref_change_registrar_.reset(new PrefChangeRegistrar);
local_state_pref_change_registrar_->Init(g_browser_process->local_state());
Expand Down Expand Up @@ -809,7 +761,6 @@ void AccessibilityManager::SetProfile(Profile* profile) {
UpdateHighContrastFromPref();
UpdateAutoclickFromPref();
UpdateAutoclickDelayFromPref();
UpdateVirtualKeyboardFromPref();
}

void AccessibilityManager::ActiveUserChanged(const std::string& user_id) {
Expand Down Expand Up @@ -844,7 +795,7 @@ void AccessibilityManager::UpdateChromeOSAccessibilityHistograms() {
UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast",
IsHighContrastEnabled());
UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard",
IsVirtualKeyboardEnabled());
accessibility::IsVirtualKeyboardEnabled());
if (MagnificationManager::Get()) {
uint32 type = MagnificationManager::Get()->IsMagnifierEnabled() ?
MagnificationManager::Get()->GetMagnifierType() : 0;
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/chromeos/accessibility/accessibility_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ class AccessibilityManager : public content::NotificationObserver,
// Returns the autoclick delay in milliseconds.
int GetAutoclickDelay() const;

// Enables or disables the virtual keyboard.
void EnableVirtualKeyboard(bool enabled);
// Returns true if the virtual keyboard is enabled, otherwise false.
bool IsVirtualKeyboardEnabled();

// SessionStateObserver overrides:
virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE;

Expand Down Expand Up @@ -155,7 +150,6 @@ class AccessibilityManager : public content::NotificationObserver,
void UpdateHighContrastFromPref();
void UpdateAutoclickFromPref();
void UpdateAutoclickDelayFromPref();
void UpdateVirtualKeyboardFromPref();
void LocalePrefChanged();

void CheckBrailleState();
Expand Down Expand Up @@ -205,15 +199,13 @@ class AccessibilityManager : public content::NotificationObserver,
PrefHandler high_contrast_pref_handler_;
PrefHandler autoclick_pref_handler_;
PrefHandler autoclick_delay_pref_handler_;
PrefHandler virtual_keyboard_pref_handler_;

bool large_cursor_enabled_;
bool sticky_keys_enabled_;
bool spoken_feedback_enabled_;
bool high_contrast_enabled_;
bool autoclick_enabled_;
int autoclick_delay_ms_;
bool virtual_keyboard_enabled_;

ash::AccessibilityNotificationVisibility spoken_feedback_notification_;

Expand Down
Loading

0 comments on commit b1ce2d4

Please sign in to comment.