Revert 138212 - Implement High Contrast mode for Chrome OS.

-Add controller to ash for managing the state of High Contrast mode
-Add API to shell to allow Chromium to turn the mode on and off
-Add the option to the Chromium OS accessibility settings page.
-Add functions to layer.cc/h to enable an inversion filter.

This change breaks the build on the Windows canaries after WebKit r117864 due
to a change in the the Chromium WebFilterOperation API.

See
http://build.chromium.org/p/chromium.webkit/builders/Win%20Builder/builds/22082
and https://bugs.webkit.org/show_bug.cgi?id=87046.

BUG=chromium-os:30678

Review URL: https://chromiumcodereview.appspot.com/10201014

TBR=zork@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10407089

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138239 0039d316-1c4b-4281-b951-d872f2087c98
parent beb38e49
...@@ -67,8 +67,6 @@ ...@@ -67,8 +67,6 @@
'drag_drop/drag_image_view.h', 'drag_drop/drag_image_view.h',
'focus_cycler.cc', 'focus_cycler.cc',
'focus_cycler.h', 'focus_cycler.h',
'high_contrast/high_contrast_controller.cc',
'high_contrast/high_contrast_controller.h',
'key_rewriter_delegate.h', 'key_rewriter_delegate.h',
'launcher/background_animator.cc', 'launcher/background_animator.cc',
'launcher/background_animator.h', 'launcher/background_animator.h',
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/shell.h"
#include "ui/aura/root_window.h"
#include "ui/compositor/layer.h"
namespace ash {
HighContrastController::HighContrastController()
: enabled_(false) {
root_window_ = ash::Shell::GetRootWindow();
}
void HighContrastController::SetEnabled(bool enabled) {
enabled_ = enabled;
root_window_->layer()->SetInverted(enabled_);
}
} // namespace ash
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_HIGH_CONTRAST_HIGH_CONTRAST_CONTROLLER_H_
#define ASH_HIGH_CONTRAST_HIGH_CONTRAST_CONTROLLER_H_
#pragma once
#include "ash/ash_export.h"
#include "base/basictypes.h"
namespace aura {
class RootWindow;
}
namespace ash {
class ASH_EXPORT HighContrastController {
public:
HighContrastController();
~HighContrastController() {}
void SetEnabled(bool enabled);
private:
aura::RootWindow* root_window_;
bool enabled_;
DISALLOW_COPY_AND_ASSIGN(HighContrastController);
};
} // namespace ash
#endif // ASH_HIGH_CONTRAST_HIGH_CONTRAST_CONTROLLER_H_
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "ash/desktop_background/desktop_background_view.h" #include "ash/desktop_background/desktop_background_view.h"
#include "ash/drag_drop/drag_drop_controller.h" #include "ash/drag_drop/drag_drop_controller.h"
#include "ash/focus_cycler.h" #include "ash/focus_cycler.h"
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/launcher/launcher.h" #include "ash/launcher/launcher.h"
#include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/magnification_controller.h"
#include "ash/monitor/monitor_controller.h" #include "ash/monitor/monitor_controller.h"
...@@ -755,7 +754,6 @@ void Shell::Init() { ...@@ -755,7 +754,6 @@ void Shell::Init() {
drag_drop_controller_.reset(new internal::DragDropController); drag_drop_controller_.reset(new internal::DragDropController);
magnification_controller_.reset(new internal::MagnificationController); magnification_controller_.reset(new internal::MagnificationController);
high_contrast_controller_.reset(new HighContrastController);
power_button_controller_.reset(new PowerButtonController); power_button_controller_.reset(new PowerButtonController);
AddShellObserver(power_button_controller_.get()); AddShellObserver(power_button_controller_.get());
video_detector_.reset(new VideoDetector); video_detector_.reset(new VideoDetector);
......
...@@ -53,7 +53,6 @@ namespace ash { ...@@ -53,7 +53,6 @@ namespace ash {
class AcceleratorController; class AcceleratorController;
class DesktopBackgroundController; class DesktopBackgroundController;
class HighContrastController;
class Launcher; class Launcher;
class NestedDispatcherController; class NestedDispatcherController;
class PowerButtonController; class PowerButtonController;
...@@ -238,14 +237,9 @@ class ASH_EXPORT Shell { ...@@ -238,14 +237,9 @@ class ASH_EXPORT Shell {
return user_wallpaper_delegate_.get(); return user_wallpaper_delegate_.get();
} }
HighContrastController* high_contrast_controller() {
return high_contrast_controller_.get();
}
internal::MagnificationController* magnification_controller() { internal::MagnificationController* magnification_controller() {
return magnification_controller_.get(); return magnification_controller_.get();
} }
internal::ScreenDimmer* screen_dimmer() { internal::ScreenDimmer* screen_dimmer() {
return screen_dimmer_.get(); return screen_dimmer_.get();
} }
...@@ -354,7 +348,6 @@ class ASH_EXPORT Shell { ...@@ -354,7 +348,6 @@ class ASH_EXPORT Shell {
scoped_ptr<internal::FocusCycler> focus_cycler_; scoped_ptr<internal::FocusCycler> focus_cycler_;
scoped_ptr<internal::EventClientImpl> event_client_; scoped_ptr<internal::EventClientImpl> event_client_;
scoped_ptr<internal::MonitorController> monitor_controller_; scoped_ptr<internal::MonitorController> monitor_controller_;
scoped_ptr<HighContrastController> high_contrast_controller_;
scoped_ptr<internal::MagnificationController> magnification_controller_; scoped_ptr<internal::MagnificationController> magnification_controller_;
scoped_ptr<internal::ScreenDimmer> screen_dimmer_; scoped_ptr<internal::ScreenDimmer> screen_dimmer_;
......
...@@ -6,12 +6,10 @@ ...@@ -6,12 +6,10 @@
#include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_controller.h"
#include "ash/ash_switches.h" #include "ash/ash_switches.h"
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/key_rewriter_event_filter.h" #include "ash/wm/key_rewriter_event_filter.h"
#include "ash/wm/property_util.h" #include "ash/wm/property_util.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/views/ash/caps_lock_handler.h" #include "chrome/browser/ui/views/ash/caps_lock_handler.h"
#include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
...@@ -78,9 +76,6 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { ...@@ -78,9 +76,6 @@ void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
shell->accelerator_controller()->SetVolumeControlDelegate( shell->accelerator_controller()->SetVolumeControlDelegate(
scoped_ptr<ash::VolumeControlDelegate>(new VolumeController).Pass()); scoped_ptr<ash::VolumeControlDelegate>(new VolumeController).Pass());
ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(
chromeos::accessibility::IsHighContrastEnabled());
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableZeroBrowsersOpenForTests)) { switches::kDisableZeroBrowsersOpenForTests)) {
browser::StartKeepAlive(); browser::StartKeepAlive();
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#include <queue> #include <queue>
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/shell.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/logging.h" #include "base/logging.h"
...@@ -166,10 +164,6 @@ void EnableHighContrast(bool enabled) { ...@@ -166,10 +164,6 @@ void EnableHighContrast(bool enabled) {
PrefService* pref_service = g_browser_process->local_state(); PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled); pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled);
pref_service->CommitPendingWrite(); pref_service->CommitPendingWrite();
#if defined(USE_ASH)
ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled);
#endif
} }
void EnableScreenMagnifier(bool enabled) { void EnableScreenMagnifier(bool enabled) {
...@@ -211,16 +205,6 @@ bool IsSpokenFeedbackEnabled() { ...@@ -211,16 +205,6 @@ bool IsSpokenFeedbackEnabled() {
return spoken_feedback_enabled; return spoken_feedback_enabled;
} }
bool IsHighContrastEnabled() {
if (!g_browser_process) {
return false;
}
PrefService* prefs = g_browser_process->local_state();
bool high_contrast_enabled = prefs &&
prefs->GetBoolean(prefs::kHighContrastEnabled);
return high_contrast_enabled;
}
void MaybeSpeak(const std::string& utterance) { void MaybeSpeak(const std::string& utterance) {
if (IsSpokenFeedbackEnabled()) if (IsSpokenFeedbackEnabled())
Speak(utterance); Speak(utterance);
......
...@@ -40,9 +40,6 @@ void Speak(const std::string& utterance); ...@@ -40,9 +40,6 @@ void Speak(const std::string& utterance);
// Returns true if spoken feedback is enabled, or false if not. // Returns true if spoken feedback is enabled, or false if not.
bool IsSpokenFeedbackEnabled(); bool IsSpokenFeedbackEnabled();
// Returns true if High Contrast is enabled, or false if not.
bool IsHighContrastEnabled();
// Speak the given text if the accessibility pref is already set. // Speak the given text if the accessibility pref is already set.
void MaybeSpeak(const std::string& utterance); void MaybeSpeak(const std::string& utterance);
......
...@@ -489,14 +489,6 @@ ...@@ -489,14 +489,6 @@
</label> </label>
</div> </div>
</div> </div>
<div class="option-name">
<div class="checkbox">
<label>
<input id="accessibility-high-contrast-check" type="checkbox">
<span i18n-content="accessibilityHighContrast"></span>
</label>
</div>
</div>
</div> </div>
</section> </section>
</if> </if>
......
...@@ -464,12 +464,7 @@ cr.define('options', function() { ...@@ -464,12 +464,7 @@ cr.define('options', function() {
if (cr.isChromeOS) { if (cr.isChromeOS) {
$('accessibility-spoken-feedback-check').onchange = function(event) { $('accessibility-spoken-feedback-check').onchange = function(event) {
chrome.send('spokenFeedbackChange', chrome.send('spokenFeedbackChange',
[$('accessibility-spoken-feedback-check').checked]); [$('accessibility-spoken-feedback-check').checked]);
};
$('accessibility-high-contrast-check').onchange = function(event) {
chrome.send('highContrastChange',
[$('accessibility-high-contrast-check').checked]);
}; };
} }
...@@ -1217,7 +1212,7 @@ cr.define('options', function() { ...@@ -1217,7 +1212,7 @@ cr.define('options', function() {
* @private * @private
*/ */
setHighContrastCheckboxState_: function(checked) { setHighContrastCheckboxState_: function(checked) {
$('accessibility-high-contrast-check').checked = checked; // TODO(zork): Update UI
}, },
/** /**
......
...@@ -52,7 +52,6 @@ Layer::Layer() ...@@ -52,7 +52,6 @@ Layer::Layer()
fills_bounds_opaquely_(true), fills_bounds_opaquely_(true),
layer_updated_externally_(false), layer_updated_externally_(false),
opacity_(1.0f), opacity_(1.0f),
inverted_(false),
delegate_(NULL), delegate_(NULL),
scale_canvas_(true), scale_canvas_(true),
device_scale_factor_(1.0f) { device_scale_factor_(1.0f) {
...@@ -67,7 +66,6 @@ Layer::Layer(LayerType type) ...@@ -67,7 +66,6 @@ Layer::Layer(LayerType type)
fills_bounds_opaquely_(true), fills_bounds_opaquely_(true),
layer_updated_externally_(false), layer_updated_externally_(false),
opacity_(1.0f), opacity_(1.0f),
inverted_(false),
delegate_(NULL), delegate_(NULL),
scale_canvas_(true), scale_canvas_(true),
device_scale_factor_(1.0f) { device_scale_factor_(1.0f) {
...@@ -196,7 +194,8 @@ void Layer::SetOpacity(float opacity) { ...@@ -196,7 +194,8 @@ void Layer::SetOpacity(float opacity) {
GetAnimator()->SetOpacity(opacity); GetAnimator()->SetOpacity(opacity);
} }
void Layer::SetBackgroundBlur(int blur_radius) { void Layer::SetBackgroundBlur(int blur_radius)
{
WebKit::WebFilterOperations filters; WebKit::WebFilterOperations filters;
if (blur_radius) { if (blur_radius) {
#if WEBKIT_HAS_NEW_WEBFILTEROPERATION_API #if WEBKIT_HAS_NEW_WEBFILTEROPERATION_API
...@@ -210,18 +209,6 @@ void Layer::SetBackgroundBlur(int blur_radius) { ...@@ -210,18 +209,6 @@ void Layer::SetBackgroundBlur(int blur_radius) {
background_blur_radius_ = blur_radius; background_blur_radius_ = blur_radius;
} }
void Layer::SetInverted(bool inverted) {
WebKit::WebFilterOperations filters;
if (inverted) {
filters.append(WebKit::WebBasicComponentTransferFilterOperation(
WebKit::WebBasicComponentTransferFilterOperation::
BasicComponentTransferFilterTypeInvert, 1.0));
}
web_layer_.setFilters(filters);
inverted_ = inverted;
}
float Layer::GetTargetOpacity() const { float Layer::GetTargetOpacity() const {
if (animator_.get() && animator_->IsAnimatingProperty( if (animator_.get() && animator_->IsAnimatingProperty(
LayerAnimationElement::OPACITY)) LayerAnimationElement::OPACITY))
......
...@@ -134,10 +134,6 @@ class COMPOSITOR_EXPORT Layer : ...@@ -134,10 +134,6 @@ class COMPOSITOR_EXPORT Layer :
int background_blur() const { return background_blur_radius_; } int background_blur() const { return background_blur_radius_; }
void SetBackgroundBlur(int blur_radius); void SetBackgroundBlur(int blur_radius);
// Invert the layer.
bool inverted() const { return inverted_; }
void SetInverted(bool inverted);
// Return the target opacity if animator is running, or the current opacity // Return the target opacity if animator is running, or the current opacity
// otherwise. // otherwise.
float GetTargetOpacity() const; float GetTargetOpacity() const;
...@@ -292,7 +288,6 @@ class COMPOSITOR_EXPORT Layer : ...@@ -292,7 +288,6 @@ class COMPOSITOR_EXPORT Layer :
float opacity_; float opacity_;
int background_blur_radius_; int background_blur_radius_;
bool inverted_;
std::string name_; std::string name_;
......
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