summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc24
-rw-r--r--chrome/browser/renderer_host/render_view_host.h5
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view.h6
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc88
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h19
5 files changed, 43 insertions, 99 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 285e24e..2dc570e 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -676,10 +676,6 @@ bool RenderViewHost::SuddenTerminationAllowed() const {
return sudden_termination_allowed_ || process()->sudden_termination_allowed();
}
-void RenderViewHost::RequestAccessibilityTree() {
- Send(new ViewMsg_GetAccessibilityTree(routing_id()));
-}
-
///////////////////////////////////////////////////////////////////////////////
// RenderViewHost, IPC message handlers:
@@ -832,7 +828,6 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents)
IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated)
IPC_MESSAGE_HANDLER(ViewHostMsg_ContentBlocked, OnContentBlocked)
- IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityTree, OnAccessibilityTree)
// Have the super handle all other messages.
IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg))
IPC_END_MESSAGE_MAP_EX()
@@ -1831,16 +1826,21 @@ void RenderViewHost::OnExtensionPostMessage(
}
void RenderViewHost::OnAccessibilityFocusChange(int acc_obj_id) {
- view()->OnAccessibilityFocusChange(acc_obj_id);
+#if defined(OS_WIN)
+ BrowserAccessibilityManager::GetInstance()->ChangeAccessibilityFocus(
+ acc_obj_id, process()->id(), routing_id());
+#else
+ // TODO(port): accessibility not yet implemented. See http://crbug.com/8288.
+#endif
}
void RenderViewHost::OnAccessibilityObjectStateChange(int acc_obj_id) {
- view()->OnAccessibilityObjectStateChange(acc_obj_id);
-}
-
-void RenderViewHost::OnAccessibilityTree(
- const webkit_glue::WebAccessibility& tree) {
- view()->UpdateAccessibilityTree(tree);
+#if defined(OS_WIN)
+ BrowserAccessibilityManager::GetInstance()->OnAccessibilityObjectStateChange(
+ acc_obj_id, process()->id(), routing_id());
+#else
+ // TODO(port): accessibility not yet implemented. See http://crbug.com/8288.
+#endif
}
void RenderViewHost::OnCSSInserted() {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index c5bec3c..0fffedd 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -22,7 +22,6 @@
#include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h"
#include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h"
#include "webkit/glue/password_form_dom_manager.h"
-#include "webkit/glue/webaccessibility.h"
#include "webkit/glue/window_open_disposition.h"
class FilePath;
@@ -465,9 +464,6 @@ class RenderViewHost : public RenderWidgetHost {
// changed.
void EnablePreferredSizeChangedMode();
- // Requests a snapshot of an accessible DOM tree from the renderer.
- void RequestAccessibilityTree();
-
protected:
// RenderWidgetHost protected overrides.
virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
@@ -629,7 +625,6 @@ class RenderViewHost : public RenderWidgetHost {
void OnExtensionPostMessage(int port_id, const std::string& message);
void OnAccessibilityFocusChange(int acc_obj_id);
void OnAccessibilityObjectStateChange(int acc_obj_id);
- void OnAccessibilityTree(const webkit_glue::WebAccessibility& tree);
void OnCSSInserted();
void OnPageContents(const GURL& url,
int32 page_id,
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index 3a285c1..6e5e28e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view.h
+++ b/chrome/browser/renderer_host/render_widget_host_view.h
@@ -15,7 +15,6 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h"
#include "webkit/glue/plugins/webplugin.h"
-#include "webkit/glue/webaccessibility.h"
namespace gfx {
class Rect;
@@ -236,11 +235,6 @@ class RenderWidgetHostView {
// widget associated with this RenderWidgetHostView.
virtual bool ContainsNativeView(gfx::NativeView native_view) const = 0;
- virtual void UpdateAccessibilityTree(
- const webkit_glue::WebAccessibility& tree) { }
- virtual void OnAccessibilityFocusChange(int acc_obj_id) { }
- virtual void OnAccessibilityObjectStateChange(int acc_obj_id) { }
-
protected:
// Interface class only, do not construct.
RenderWidgetHostView() : popup_type_(WebKit::WebPopupTypeNone) {}
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 34d09b2..975609e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -13,7 +13,6 @@
#include "base/process_util.h"
#include "base/thread.h"
#include "base/win_util.h"
-#include "chrome/browser/browser_accessibility.h"
#include "chrome/browser/browser_accessibility_manager.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_trial.h"
@@ -27,7 +26,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/native_web_keyboard_event.h"
-#include "chrome/common/notification_service.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "gfx/canvas.h"
@@ -287,9 +285,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
renderer_accessible_ =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableRendererAccessibility);
- registrar_.Add(this,
- NotificationType::RENDERER_PROCESS_TERMINATED,
- NotificationService::AllSources());
}
RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
@@ -1467,65 +1462,40 @@ LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT, WPARAM, LPARAM,
return MA_ACTIVATE;
}
-void RenderWidgetHostViewWin::UpdateAccessibilityTree(
- const webkit_glue::WebAccessibility& tree) {
- browser_accessibility_manager_.reset(
- new BrowserAccessibilityManager(m_hWnd, tree));
-}
-
-void RenderWidgetHostViewWin::OnAccessibilityFocusChange(int acc_obj_id) {
- if (browser_accessibility_manager_.get()) {
- browser_accessibility_manager_->OnAccessibilityFocusChange(acc_obj_id);
- }
-}
-
-void RenderWidgetHostViewWin::OnAccessibilityObjectStateChange(int acc_obj_id) {
- if (browser_accessibility_manager_.get()) {
- browser_accessibility_manager_->OnAccessibilityObjectStateChange(
- acc_obj_id);
- }
-}
-
-void RenderWidgetHostViewWin::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED);
-
- // Get the RenderProcessHost that posted this notification, and exit
- // if it's not the one associated with this host view.
- RenderProcessHost* render_process_host =
- Source<RenderProcessHost>(source).ptr();
- DCHECK(render_process_host);
- if (render_widget_host_ == NULL ||
- render_process_host != render_widget_host_->process()) {
- return;
- }
-
- // If it was our RenderProcessHost that posted the notification,
- // clear the BrowserAccessibilityManager, because the renderer is
- // dead and any accessibility information we have is now stale.
- browser_accessibility_manager_.reset(NULL);
-}
-
LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled) {
- // TODO(dmazzoni): http://crbug.com/25564 Disabling accessibility in the
+ LRESULT reference_result = static_cast<LRESULT>(0L);
+ // TODO(jcampan): http://b/issue?id=1432077 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 (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()));
+ if (!renderer_accessible_)
+ return reference_result;
+
+ // Accessibility readers will send an OBJID_CLIENT message.
+ if (OBJID_CLIENT == lparam) {
+ // If our MSAA DOM root is already created, reuse that pointer. Otherwise,
+ // create a new one.
+ if (!browser_accessibility_root_) {
+ // Create a new instance of IAccessible. Root id is 1000, to avoid
+ // conflicts with the ids used by MSAA.
+ BrowserAccessibilityManager::GetInstance()->CreateAccessibilityInstance(
+ IID_IAccessible, 1000,
+ render_widget_host_->routing_id(),
+ render_widget_host_->process()->id(),
+ m_hWnd,
+ reinterpret_cast<void **>(browser_accessibility_root_.Receive()));
+
+ if (!browser_accessibility_root_) {
+ // No valid root found, return with failure.
+ return static_cast<LRESULT>(0L);
+ }
}
- }
- handled = false;
- return static_cast<LRESULT>(0L);
+ // Create a reference to BrowserAccessibility which MSAA will marshall to
+ // the client.
+ reference_result = LresultFromObject(IID_IAccessible, wparam,
+ static_cast<IAccessible*>(browser_accessibility_root_));
+ }
+ return reference_result;
}
void RenderWidgetHostViewWin::OnFinalMessage(HWND window) {
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 23716b9..09686ad 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -13,10 +13,8 @@
#include "base/scoped_comptr_win.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "chrome/browser/browser_accessibility_manager.h"
#include "chrome/browser/ime_input.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
-#include "chrome/common/notification_registrar.h"
#include "webkit/glue/webcursor.h"
namespace gfx {
@@ -57,8 +55,7 @@ class RenderWidgetHostViewWin
: public CWindowImpl<RenderWidgetHostViewWin,
CWindow,
RenderWidgetHostHWNDTraits>,
- public RenderWidgetHostView,
- public NotificationObserver {
+ public RenderWidgetHostView {
public:
// The view will associate itself with the given widget.
explicit RenderWidgetHostViewWin(RenderWidgetHost* widget);
@@ -144,15 +141,6 @@ class RenderWidgetHostViewWin
virtual void SetBackground(const SkBitmap& background);
virtual bool ContainsNativeView(gfx::NativeView native_view) const;
virtual void SetVisuallyDeemphasized(bool deemphasized);
- virtual void UpdateAccessibilityTree(
- const webkit_glue::WebAccessibility& tree);
- virtual void OnAccessibilityFocusChange(int acc_obj_id);
- virtual void OnAccessibilityObjectStateChange(int acc_obj_id);
-
- // Implementation of NotificationObserver:
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
protected:
// Windows Message Handlers
@@ -308,7 +296,7 @@ class RenderWidgetHostViewWin
// Instance of accessibility information for the root of the MSAA
// tree representation of the WebKit render tree.
- scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
+ ScopedComPtr<IAccessible> browser_accessibility_root_;
// The time at which this view started displaying white pixels as a result of
// not having anything to paint (empty backing store from renderer). This
@@ -327,9 +315,6 @@ class RenderWidgetHostViewWin
// whenever we paint.
bool visually_deemphasized_;
- // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events.
- NotificationRegistrar registrar_;
-
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin);
};