summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 00:08:32 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 00:08:32 +0000
commitead48028cab08493a3a5c897bcf779602d1cbe85 (patch)
treea5eab2ac1f2e3670bceb797bd44dfd0cf5679b51 /chrome/browser/renderer_host
parent662256279693de926046e988d1136469e1125daf (diff)
downloadchromium_src-ead48028cab08493a3a5c897bcf779602d1cbe85.zip
chromium_src-ead48028cab08493a3a5c897bcf779602d1cbe85.tar.gz
chromium_src-ead48028cab08493a3a5c897bcf779602d1cbe85.tar.bz2
Revert 49339 - Enable renderer accessibility by default.
It seems to be breaking the ExtensionAPIClientTest.CreateWindowW unit-test. BUG=25564 TEST=none Review URL: http://codereview.chromium.org/2358003 TBR=ctguil@chromium.org Review URL: http://codereview.chromium.org/2782003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49343 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc34
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h22
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc51
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h10
4 files changed, 14 insertions, 103 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 125c8a9..673a237 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "base/auto_reset.h"
-#include "base/command_line.h"
#include "base/histogram.h"
#include "base/keyboard_codes.h"
#include "base/message_loop.h"
@@ -17,7 +16,6 @@
#include "chrome/browser/renderer_host/render_widget_host_painting_observer.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/renderer_host/video_layer.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "webkit/glue/webcursor.h"
@@ -60,9 +58,6 @@ static const int kHungRendererDelayMs = 20000;
// in trailing scrolls after the user ends their input.
static const int kMaxTimeBetweenWheelMessagesMs = 250;
-// static
-bool RenderWidgetHost::renderer_accessible_ = false;
-
///////////////////////////////////////////////////////////////////////////////
// RenderWidgetHost
@@ -1116,35 +1111,6 @@ void RenderWidgetHost::RequestAccessibilityTree() {
Send(new ViewMsg_GetAccessibilityTree(routing_id()));
}
-void RenderWidgetHost::SetDocumentLoaded(bool document_loaded) {
- document_loaded_ = document_loaded;
-
- if (!document_loaded_)
- requested_accessibility_tree_ = false;
-
- if (renderer_accessible_ && document_loaded_) {
- RequestAccessibilityTree();
- requested_accessibility_tree_ = true;
- }
-}
-
-void RenderWidgetHost::EnableRendererAccessibility() {
- if (renderer_accessible_)
- return;
-
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableRendererAccessibility)) {
- return;
- }
-
- renderer_accessible_ = true;
-
- if (document_loaded_ && !requested_accessibility_tree_) {
- RequestAccessibilityTree();
- requested_accessibility_tree_ = true;
- }
-}
-
void RenderWidgetHost::SetAccessibilityFocus(int acc_obj_id) {
Send(new ViewMsg_SetAccessibilityFocus(routing_id(), acc_obj_id));
}
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index 27bb5dd..ab64ef7 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -6,8 +6,6 @@
#define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_
#include <deque>
-#include <string>
-#include <vector>
#include "app/surface/transport_dib.h"
#include "base/gtest_prod_util.h"
@@ -372,14 +370,6 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// Requests a snapshot of an accessible DOM tree from the renderer.
void RequestAccessibilityTree();
- // Aid for determining when an accessibility tree request can be made. Set by
- // TabContents to true on document load and to false on page nativigation.
- void SetDocumentLoaded(bool document_loaded);
-
- // Enable renderer accessibility. This should only be called when a
- // screenreader is detected.
- void EnableRendererAccessibility();
-
// Relays a request from assistive technology to set focus to the
// node with this accessibility object id.
void SetAccessibilityFocus(int acc_obj_id);
@@ -540,10 +530,6 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// input messages to be coalesced.
void ProcessWheelAck();
- // True if renderer accessibility is enabled. This should only be set when a
- // screenreader is detected as it can potentially slow down Chrome.
- static bool renderer_accessible_;
-
// The View associated with the RenderViewHost. The lifetime of this object
// is associated with the lifetime of the Render process. If the Renderer
// crashes, its View is destroyed and this pointer becomes NULL, even though
@@ -681,14 +667,6 @@ class RenderWidgetHost : public IPC::Channel::Listener,
// changed.
bool suppress_next_char_events_;
- // Keep track of if we have a loaded document so that we can request an
- // accessibility tree on demand when renderer accessibility is enabled.
- bool document_loaded_;
-
- // Keep track of if we've already requested the accessibility tree so
- // we don't do it more than once.
- bool requested_accessibility_tree_;
-
// Optional video YUV layer for used for out-of-process compositing.
scoped_ptr<VideoLayer> video_layer_;
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index a6ce128..e195317 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -252,6 +252,7 @@ void DrawDeemphasized(const gfx::Rect& paint_rect,
paint_rect.width(), paint_rect.height());
canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(),
paint_rect.y(), NULL);
+
}
} // namespace
@@ -283,15 +284,12 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
is_loading_(false),
visually_deemphasized_(false) {
render_widget_host_->set_view(this);
+ renderer_accessible_ =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableRendererAccessibility);
registrar_.Add(this,
NotificationType::RENDERER_PROCESS_TERMINATED,
NotificationService::AllSources());
-
- BOOL screenreader_running = FALSE;
- if (SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenreader_running, 0) &&
- screenreader_running) {
- render_widget_host_->EnableRendererAccessibility();
- }
}
RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
@@ -1485,9 +1483,6 @@ void RenderWidgetHostViewWin::UpdateAccessibilityTree(
const webkit_glue::WebAccessibility& tree) {
browser_accessibility_manager_.reset(
new BrowserAccessibilityManager(m_hWnd, tree, this));
-
- ::NotifyWinEvent(
- IA2_EVENT_DOCUMENT_LOAD_COMPLETE, m_hWnd, OBJID_CLIENT, CHILDID_SELF);
}
void RenderWidgetHostViewWin::OnAccessibilityFocusChange(int acc_obj_id) {
@@ -1547,46 +1542,18 @@ void RenderWidgetHostViewWin::AccessibilityDoDefaultAction(int acc_obj_id) {
LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled) {
- if (lparam != OBJID_CLIENT) {
+ // TODO(dmazzoni): http://crbug.com/25564 Disabling accessibility in the
+ // renderer is a temporary work-around until that bug is fixed.
+ if (!renderer_accessible_) {
handled = false;
return static_cast<LRESULT>(0L);
}
- if (!browser_accessibility_manager_.get()) {
- render_widget_host_->EnableRendererAccessibility();
-
- if (!loading_accessible_.get()) {
- // Create IAccessible to return while waiting for the accessibility tree
- // from the renderer.
- HRESULT hr = ::CreateStdAccessibleObject(
- m_hWnd, OBJID_CLIENT, IID_IAccessible,
- reinterpret_cast<void **>(&loading_accessible_));
-
- // Annotate with STATE_SYSTEM_BUSY to indicate that the page is loading.
- // We annotate the HWND, not the loading_accessible IAccessible, but the
- // IAccessible will reflect the state annotation.
- ScopedComPtr<IAccPropServices> pAccPropServices;
- hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
- IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
- if (SUCCEEDED(hr)) {
- VARIANT var;
- var.vt = VT_I4;
- var.lVal = STATE_SYSTEM_BUSY;
- pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT,
- CHILDID_SELF, PROPID_ACC_STATE, var);
- }
- }
-
- if (loading_accessible_.get()) {
- return LresultFromObject(
- IID_IAccessible, wparam,
- static_cast<IAccessible*>(loading_accessible_));
- }
- } else {
+ if (lparam == OBJID_CLIENT && browser_accessibility_manager_.get()) {
BrowserAccessibility* root = browser_accessibility_manager_->GetRoot();
if (root) {
return LresultFromObject(IID_IAccessible, wparam,
- static_cast<IAccessible*>(root->NewReference()));
+ static_cast<IAccessible*>(root->NewReference()));
}
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h
index 9580e88..c298f58 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -10,8 +10,6 @@
#include <atlcrack.h>
#include <atlmisc.h>
-#include <vector>
-
#include "base/scoped_comptr_win.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
@@ -251,9 +249,6 @@ class RenderWidgetHostViewWin
// Whether the window should be activated.
bool IsActivatable() const;
- // MSAA IAccessible returned while page contents is loading.
- ScopedComPtr<IAccessible> loading_accessible_;
-
// The associated Model.
RenderWidgetHost* render_widget_host_;
@@ -325,6 +320,11 @@ class RenderWidgetHostViewWin
// value returns true for is_null() if we are not recording whiteout times.
base::TimeTicks whiteout_start_time_;
+ // Whether the renderer is made accessible.
+ // TODO(jcampan): http://b/issue?id=1432077 This is a temporary work-around
+ // until that bug is fixed.
+ bool renderer_accessible_;
+
// The time it took after this view was selected for it to be fully painted.
base::TimeTicks tab_switch_paint_time_;