diff options
25 files changed, 342 insertions, 302 deletions
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc index 7972e3b..4f81569 100644 --- a/content/browser/accessibility/browser_accessibility.cc +++ b/content/browser/accessibility/browser_accessibility.cc @@ -8,7 +8,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "content/browser/accessibility/browser_accessibility_manager.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" typedef WebAccessibility::BoolAttribute BoolAttribute; typedef WebAccessibility::FloatAttribute FloatAttribute; @@ -184,13 +184,13 @@ void BrowserAccessibility::InternalReleaseReference(bool recursive) { ref_count_--; if (ref_count_ == 0) { - // Allow the object to fire a TEXT_REMOVED notification. + // Allow the object to fire a TextRemoved notification. name_.clear(); value_.clear(); PostInitialize(); manager_->NotifyAccessibilityEvent( - ViewHostMsg_AccEvent::OBJECT_HIDE, this); + AccessibilityNotificationObjectHide, this); instance_active_ = false; manager_->Remove(child_id_, renderer_id_); diff --git a/content/browser/accessibility/browser_accessibility_manager.cc b/content/browser/accessibility/browser_accessibility_manager.cc index da6ee4c..4d81dae 100644 --- a/content/browser/accessibility/browser_accessibility_manager.cc +++ b/content/browser/accessibility/browser_accessibility_manager.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "content/browser/accessibility/browser_accessibility.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" using webkit_glue::WebAccessibility; @@ -116,7 +116,7 @@ void BrowserAccessibilityManager::GotFocus() { if (!focus_) return; - NotifyAccessibilityEvent(ViewHostMsg_AccEvent::FOCUS_CHANGED, focus_); + NotifyAccessibilityEvent(AccessibilityNotificationFocusChanged, focus_); } void BrowserAccessibilityManager::Remove(int32 child_id, int32 renderer_id) { @@ -131,9 +131,9 @@ void BrowserAccessibilityManager::Remove(int32 child_id, int32 renderer_id) { } void BrowserAccessibilityManager::OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { + const std::vector<AccessibilityHostMsg_NotificationParams>& params) { for (uint32 index = 0; index < params.size(); index++) { - const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; + const AccessibilityHostMsg_NotificationParams& param = params[index]; // Update the tree. UpdateNode(param.acc_tree, param.includes_children); @@ -152,7 +152,7 @@ void BrowserAccessibilityManager::OnAccessibilityNotifications( continue; } - if (param.notification_type == ViewHostMsg_AccEvent::FOCUS_CHANGED) { + if (param.notification_type == AccessibilityNotificationFocusChanged) { SetFocus(node, false); // Don't send a native focus event if the window itself doesn't @@ -165,11 +165,11 @@ void BrowserAccessibilityManager::OnAccessibilityNotifications( NotifyAccessibilityEvent(param.notification_type, node); // Set initial focus when a page is loaded. - if (param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE) { + if (param.notification_type == AccessibilityNotificationLoadComplete) { if (!focus_) SetFocus(root_, false); if (!delegate_ || delegate_->HasFocus()) - NotifyAccessibilityEvent(ViewHostMsg_AccEvent::FOCUS_CHANGED, focus_); + NotifyAccessibilityEvent(AccessibilityNotificationFocusChanged, focus_); } } } @@ -295,7 +295,7 @@ void BrowserAccessibilityManager::UpdateNode( if (focus_ && focus_->ref_count() == 1) { SetFocus(root_, true); if (!delegate_ || delegate_->HasFocus()) - NotifyAccessibilityEvent(ViewHostMsg_AccEvent::FOCUS_CHANGED, focus_); + NotifyAccessibilityEvent(AccessibilityNotificationFocusChanged, focus_); } } @@ -360,11 +360,11 @@ BrowserAccessibility* BrowserAccessibilityManager::CreateAccessibilityTree( root_ = instance; // Note: the purpose of send_show_events and children_can_send_show_events - // is so that we send a single OBJECT_SHOW event for the root of a subtree + // is so that we send a single ObjectShow event for the root of a subtree // that just appeared for the first time, but not on any descendant of // that subtree. if (send_show_events) - NotifyAccessibilityEvent(ViewHostMsg_AccEvent::OBJECT_SHOW, instance); + NotifyAccessibilityEvent(AccessibilityNotificationObjectShow, instance); instance->PostInitialize(); diff --git a/content/browser/accessibility/browser_accessibility_manager.h b/content/browser/accessibility/browser_accessibility_manager.h index 650b603..51258df 100644 --- a/content/browser/accessibility/browser_accessibility_manager.h +++ b/content/browser/accessibility/browser_accessibility_manager.h @@ -22,7 +22,7 @@ class BrowserAccessibilityManagerWin; using webkit_glue::WebAccessibility; -struct ViewHostMsg_AccessibilityNotification_Params; +struct AccessibilityHostMsg_NotificationParams; // Class that can perform actions on behalf of the BrowserAccessibilityManager. class CONTENT_EXPORT BrowserAccessibilityDelegate { @@ -70,8 +70,8 @@ class CONTENT_EXPORT BrowserAccessibilityManager { virtual ~BrowserAccessibilityManager(); - // Type is a ViewHostMsg_AccessibilityNotification_Type::int. - // We pass it as int so that we don't include the render message declaration + // Type is enum AccessibilityNotification. + // We pass it as int so that we don't include the message declaration // header here. virtual void NotifyAccessibilityEvent( int type, @@ -128,7 +128,7 @@ class CONTENT_EXPORT BrowserAccessibilityManager { // Called when the renderer process has notified us of about tree changes. // Send a notification to MSAA clients of the change. void OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); + const std::vector<AccessibilityHostMsg_NotificationParams>& params); gfx::NativeView GetParentView(); diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm index 8d2a22e..f9d6730 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -6,7 +6,7 @@ #import "base/logging.h" #import "content/browser/accessibility/browser_accessibility_cocoa.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" // static BrowserAccessibilityManager* BrowserAccessibilityManager::Create( @@ -32,66 +32,66 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( // Refer to AXObjectCache.mm (webkit). NSString* event_id = @""; switch (type) { - case ViewHostMsg_AccEvent::ACTIVE_DESCENDANT_CHANGED: + case AccessibilityNotificationActiveDescendantChanged: if (node->role() == WebAccessibility::ROLE_TREE) event_id = NSAccessibilitySelectedRowsChangedNotification; else event_id = NSAccessibilityFocusedUIElementChangedNotification; - case ViewHostMsg_AccEvent::ALERT: + case AccessibilityNotificationAlert: // Not used on Mac. return; - case ViewHostMsg_AccEvent::CHECK_STATE_CHANGED: + case AccessibilityNotificationCheckStateChanged: // Not used on Mac. return; - case ViewHostMsg_AccEvent::CHILDREN_CHANGED: + case AccessibilityNotificationChildrenChanged: // TODO(dtseng): no clear equivalent on Mac. return; - case ViewHostMsg_AccEvent::FOCUS_CHANGED: + case AccessibilityNotificationFocusChanged: event_id = NSAccessibilityFocusedUIElementChangedNotification; break; - case ViewHostMsg_AccEvent::LAYOUT_COMPLETE: + case AccessibilityNotificationLayoutComplete: event_id = @"AXLayoutComplete"; break; - case ViewHostMsg_AccEvent::LIVE_REGION_CHANGED: + case AccessibilityNotificationLiveRegionChanged: event_id = @"AXLiveRegionChanged"; break; - case ViewHostMsg_AccEvent::LOAD_COMPLETE: + case AccessibilityNotificationLoadComplete: event_id = @"AXLoadComplete"; break; - case ViewHostMsg_AccEvent::MENU_LIST_VALUE_CHANGED: + case AccessibilityNotificationMenuListValueChanged: // Not used on Mac. return; - case ViewHostMsg_AccEvent::OBJECT_SHOW: + case AccessibilityNotificationObjectShow: // Not used on Mac. return; - case ViewHostMsg_AccEvent::OBJECT_HIDE: + case AccessibilityNotificationObjectHide: // Not used on Mac. return; - case ViewHostMsg_AccEvent::ROW_COUNT_CHANGED: + case AccessibilityNotificationRowCountChanged: event_id = NSAccessibilityRowCountChangedNotification; break; - case ViewHostMsg_AccEvent::ROW_COLLAPSED: + case AccessibilityNotificationRowCollapsed: event_id = @"AXRowCollapsed"; break; - case ViewHostMsg_AccEvent::ROW_EXPANDED: + case AccessibilityNotificationRowExpanded: event_id = @"AXRowExpanded"; break; - case ViewHostMsg_AccEvent::SCROLLED_TO_ANCHOR: + case AccessibilityNotificationScrolledToAnchor: // Not used on Mac. return; - case ViewHostMsg_AccEvent::SELECTED_CHILDREN_CHANGED: + case AccessibilityNotificationSelectedChildrenChanged: event_id = NSAccessibilitySelectedChildrenChangedNotification; break; - case ViewHostMsg_AccEvent::SELECTED_TEXT_CHANGED: + case AccessibilityNotificationSelectedTextChanged: event_id = NSAccessibilitySelectedTextChangedNotification; break; - case ViewHostMsg_AccEvent::TEXT_INSERTED: + case AccessibilityNotificationTextInserted: // Not used on Mac. return; - case ViewHostMsg_AccEvent::TEXT_REMOVED: + case AccessibilityNotificationTextRemoved: // Not used on Mac. return; - case ViewHostMsg_AccEvent::VALUE_CHANGED: + case AccessibilityNotificationValueChangedD: event_id = NSAccessibilityValueChangedNotification; break; } diff --git a/content/browser/accessibility/browser_accessibility_manager_unittest.cc b/content/browser/accessibility/browser_accessibility_manager_unittest.cc index d31385e..bbc456c 100644 --- a/content/browser/accessibility/browser_accessibility_manager_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_manager_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -6,7 +6,7 @@ #include "base/utf_string_conversions.h" #include "content/browser/accessibility/browser_accessibility.h" #include "content/browser/accessibility/browser_accessibility_manager.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/webaccessibility.h" @@ -227,10 +227,10 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) { EXPECT_EQ(2, child3_accessible->index_in_parent()); // Process a notification containing the changed subtree. - std::vector<ViewHostMsg_AccessibilityNotification_Params> params; - params.push_back(ViewHostMsg_AccessibilityNotification_Params()); - ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; + std::vector<AccessibilityHostMsg_NotificationParams> params; + params.push_back(AccessibilityHostMsg_NotificationParams()); + AccessibilityHostMsg_NotificationParams* msg = ¶ms[0]; + msg->notification_type = AccessibilityNotificationChildrenChanged; msg->acc_tree = tree2_root; msg->includes_children = true; msg->id = tree2_root.id; @@ -433,10 +433,10 @@ TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) { // Process a notification containing the changed subtree rooted at // the container. - std::vector<ViewHostMsg_AccessibilityNotification_Params> params; - params.push_back(ViewHostMsg_AccessibilityNotification_Params()); - ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; + std::vector<AccessibilityHostMsg_NotificationParams> params; + params.push_back(AccessibilityHostMsg_NotificationParams()); + AccessibilityHostMsg_NotificationParams* msg = ¶ms[0]; + msg->notification_type = AccessibilityNotificationChildrenChanged; msg->acc_tree = tree2_container; msg->includes_children = true; msg->id = tree2_container.id; @@ -538,10 +538,10 @@ TEST(BrowserAccessibilityManagerTest, TestMoveChildUp) { ASSERT_EQ(4, CountedBrowserAccessibility::global_obj_count_); // Process a notification containing the changed subtree. - std::vector<ViewHostMsg_AccessibilityNotification_Params> params; - params.push_back(ViewHostMsg_AccessibilityNotification_Params()); - ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; + std::vector<AccessibilityHostMsg_NotificationParams> params; + params.push_back(AccessibilityHostMsg_NotificationParams()); + AccessibilityHostMsg_NotificationParams* msg = ¶ms[0]; + msg->notification_type = AccessibilityNotificationChildrenChanged; msg->acc_tree = tree2_1; msg->includes_children = true; msg->id = tree2_1.id; @@ -582,10 +582,10 @@ TEST(BrowserAccessibilityManagerTest, TestCreateEmptyDocument) { tree1_1.children.push_back(tree1_2); // Process a load complete. - std::vector<ViewHostMsg_AccessibilityNotification_Params> params; - params.push_back(ViewHostMsg_AccessibilityNotification_Params()); - ViewHostMsg_AccessibilityNotification_Params* msg = ¶ms[0]; - msg->notification_type = ViewHostMsg_AccEvent::LOAD_COMPLETE; + std::vector<AccessibilityHostMsg_NotificationParams> params; + params.push_back(AccessibilityHostMsg_NotificationParams()); + AccessibilityHostMsg_NotificationParams* msg = ¶ms[0]; + msg->notification_type = AccessibilityNotificationLoadComplete; msg->acc_tree = tree1_1; msg->includes_children = true; msg->id = tree1_1.id; diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc index 3bb818f..3901d93 100644 --- a/content/browser/accessibility/browser_accessibility_manager_win.cc +++ b/content/browser/accessibility/browser_accessibility_manager_win.cc @@ -5,7 +5,7 @@ #include "content/browser/accessibility/browser_accessibility_manager_win.h" #include "content/browser/accessibility/browser_accessibility_win.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" using webkit_glue::WebAccessibility; @@ -62,49 +62,49 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( BrowserAccessibility* node) { LONG event_id = EVENT_MIN; switch (type) { - case ViewHostMsg_AccEvent::ACTIVE_DESCENDANT_CHANGED: + case AccessibilityNotificationActiveDescendantChanged: event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; break; - case ViewHostMsg_AccEvent::CHECK_STATE_CHANGED: + case AccessibilityNotificationCheckStateChanged: event_id = EVENT_OBJECT_STATECHANGE; break; - case ViewHostMsg_AccEvent::CHILDREN_CHANGED: + case AccessibilityNotificationChildrenChanged: event_id = EVENT_OBJECT_REORDER; break; - case ViewHostMsg_AccEvent::FOCUS_CHANGED: + case AccessibilityNotificationFocusChanged: event_id = EVENT_OBJECT_FOCUS; break; - case ViewHostMsg_AccEvent::LOAD_COMPLETE: + case AccessibilityNotificationLoadComplete: event_id = IA2_EVENT_DOCUMENT_LOAD_COMPLETE; break; - case ViewHostMsg_AccEvent::VALUE_CHANGED: + case AccessibilityNotificationValueChangedD: event_id = EVENT_OBJECT_VALUECHANGE; break; - case ViewHostMsg_AccEvent::SELECTED_TEXT_CHANGED: + case AccessibilityNotificationSelectedTextChanged: event_id = IA2_EVENT_TEXT_CARET_MOVED; break; - case ViewHostMsg_AccEvent::LIVE_REGION_CHANGED: + case AccessibilityNotificationLiveRegionChanged: event_id = EVENT_OBJECT_REORDER; break; - case ViewHostMsg_AccEvent::TEXT_INSERTED: + case AccessibilityNotificationTextInserted: event_id = IA2_EVENT_TEXT_INSERTED; break; - case ViewHostMsg_AccEvent::TEXT_REMOVED: + case AccessibilityNotificationTextRemoved: event_id = IA2_EVENT_TEXT_REMOVED; break; - case ViewHostMsg_AccEvent::OBJECT_SHOW: + case AccessibilityNotificationObjectShow: event_id = EVENT_OBJECT_SHOW; break; - case ViewHostMsg_AccEvent::OBJECT_HIDE: + case AccessibilityNotificationObjectHide: event_id = EVENT_OBJECT_HIDE; break; - case ViewHostMsg_AccEvent::ALERT: + case AccessibilityNotificationAlert: event_id = EVENT_SYSTEM_ALERT; break; - case ViewHostMsg_AccEvent::MENU_LIST_VALUE_CHANGED: + case AccessibilityNotificationMenuListValueChanged: event_id = EVENT_OBJECT_VALUECHANGE; break; - case ViewHostMsg_AccEvent::SELECTED_CHILDREN_CHANGED: + case AccessibilityNotificationSelectedChildrenChanged: event_id = EVENT_OBJECT_SELECTIONWITHIN; break; default: @@ -119,7 +119,7 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( // If this is a layout complete notification (sent when a container scrolls) // and there is a descendant tracked object, send a notification on it. // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. - if (type == ViewHostMsg_AccEvent::LAYOUT_COMPLETE && + if (type == AccessibilityNotificationLayoutComplete && tracked_scroll_object_ && tracked_scroll_object_->IsDescendantOf(node)) { NotifyWinEvent(IA2_EVENT_VISIBLE_DATA_CHANGED, diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc index ca660a3..469d58b 100644 --- a/content/browser/accessibility/browser_accessibility_win.cc +++ b/content/browser/accessibility/browser_accessibility_win.cc @@ -10,7 +10,7 @@ #include "base/win/enum_variant.h" #include "base/win/scoped_comptr.h" #include "content/browser/accessibility/browser_accessibility_manager_win.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" #include "net/base/escape.h" #include "ui/base/accessibility/accessible_text_utils.h" @@ -2718,14 +2718,14 @@ void BrowserAccessibilityWin::PostInitialize() { // Fire an event when an alert first appears. if (role_ == WebAccessibility::ROLE_ALERT && first_time_) - manager_->NotifyAccessibilityEvent(ViewHostMsg_AccEvent::ALERT, this); + manager_->NotifyAccessibilityEvent(AccessibilityNotificationAlert, this); // Fire events if text has changed. string16 text = TextForIAccessibleText(); if (previous_text_ != text) { if (!previous_text_.empty() && !text.empty()) { manager_->NotifyAccessibilityEvent( - ViewHostMsg_AccEvent::OBJECT_SHOW, this); + AccessibilityNotificationObjectShow, this); } // TODO(dmazzoni): Look into HIDE events, too. diff --git a/content/browser/accessibility/browser_accessibility_win_unittest.cc b/content/browser/accessibility/browser_accessibility_win_unittest.cc index 4cfeb94..4afcd27 100644 --- a/content/browser/accessibility/browser_accessibility_win_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_win_unittest.cc @@ -6,7 +6,7 @@ #include "base/win/scoped_comptr.h" #include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/browser_accessibility_win.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/win/atl_module.h" @@ -188,12 +188,12 @@ TEST_F(BrowserAccessibilityTest, TestChildrenChange) { // Notify the BrowserAccessibilityManager that the text child has changed. text.name = L"new text"; - ViewHostMsg_AccessibilityNotification_Params param; - param.notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; + AccessibilityHostMsg_NotificationParams param; + param.notification_type = AccessibilityNotificationChildrenChanged; param.acc_tree = text; param.includes_children = true; param.id = text.id; - std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; + std::vector<AccessibilityHostMsg_NotificationParams> notifications; notifications.push_back(param); manager->OnAccessibilityNotifications(notifications); @@ -260,12 +260,12 @@ TEST_F(BrowserAccessibilityTest, TestChildrenChangeNoLeaks) { // Notify the BrowserAccessibilityManager that the div node and its children // were removed and ensure that only one BrowserAccessibility instance exists. root.children.clear(); - ViewHostMsg_AccessibilityNotification_Params param; - param.notification_type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; + AccessibilityHostMsg_NotificationParams param; + param.notification_type = AccessibilityNotificationChildrenChanged; param.acc_tree = root; param.includes_children = true; param.id = root.id; - std::vector<ViewHostMsg_AccessibilityNotification_Params> notifications; + std::vector<AccessibilityHostMsg_NotificationParams> notifications; notifications.push_back(param); manager->OnAccessibilityNotifications(notifications); ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 9a23089..fe0f9f2 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -27,6 +27,7 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/common/accessibility_messages.h" #include "content/common/desktop_notification_messages.h" #include "content/common/drag_messages.h" #include "content/common/speech_input_messages.h" @@ -770,8 +771,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged, OnMsgSelectionBoundsChanged) - IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityNotifications, - OnAccessibilityNotifications) IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) IPC_MESSAGE_HANDLER(ViewHostMsg_MediaNotification, OnMediaNotification) @@ -788,6 +787,8 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, OnDomOperationResponse) + IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Notifications, + OnAccessibilityNotifications) // Have the super handle all other messages. IPC_MESSAGE_UNHANDLED(handled = RenderWidgetHost::OnMessageReceived(msg)) IPC_END_MESSAGE_MAP_EX() @@ -1439,16 +1440,16 @@ void RenderViewHost::StopFinding(content::StopFindAction action) { } void RenderViewHost::OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { + const std::vector<AccessibilityHostMsg_NotificationParams>& params) { if (view() && !is_swapped_out_) view()->OnAccessibilityNotifications(params); if (!params.empty()) { for (unsigned i = 0; i < params.size(); i++) { - const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; + const AccessibilityHostMsg_NotificationParams& param = params[i]; - if ((param.notification_type == ViewHostMsg_AccEvent::LAYOUT_COMPLETE || - param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE) && + if ((param.notification_type == AccessibilityNotificationLayoutComplete || + param.notification_type == AccessibilityNotificationLoadComplete) && save_accessibility_tree_for_testing_) { accessibility_tree_ = param.acc_tree; @@ -1462,7 +1463,7 @@ void RenderViewHost::OnAccessibilityNotifications( } } - Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id())); + Send(new AccessibilityMsg_Notifications_ACK(routing_id())); } void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index c979381..7bcbd85 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -37,8 +37,8 @@ class PowerSaveBlocker; class SessionStorageNamespace; class SkBitmap; class ViewMsg_Navigate; +struct AccessibilityHostMsg_NotificationParams; struct MediaPlayerAction; -struct ViewHostMsg_AccessibilityNotification_Params; struct ViewHostMsg_CreateWindow_Params; struct ViewHostMsg_ShowPopup_Params; struct ViewMsg_Navigate_Params; @@ -583,7 +583,7 @@ class CONTENT_EXPORT RenderViewHost : public RenderWidgetHost { void OnMsgShouldCloseACK(bool proceed); void OnMsgClosePageACK(); void OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); + const std::vector<AccessibilityHostMsg_NotificationParams>& params); void OnScriptEvalResponse(int id, const base::ListValue& result); void OnDidZoomURL(double zoom_level, bool remember, const GURL& url); void OnMediaNotification(int64 player_cookie, diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index b5b38ed..1a6b65e 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -22,6 +22,7 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_helper.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/common/accessibility_messages.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/view_messages.h" #include "content/public/browser/native_web_keyboard_event.h" @@ -1348,7 +1349,7 @@ void RenderWidgetHost::EnableRendererAccessibility() { if (process_->HasConnection()) { // Renderer accessibility wasn't enabled on process launch. Enable it now. - Send(new ViewMsg_EnableAccessibility(routing_id())); + Send(new AccessibilityMsg_Enable(routing_id())); } } @@ -1420,28 +1421,28 @@ void RenderWidgetHost::SetEditCommandsForNextKeyEvent( } void RenderWidgetHost::AccessibilityDoDefaultAction(int object_id) { - Send(new ViewMsg_AccessibilityDoDefaultAction(routing_id(), object_id)); + Send(new AccessibilityMsg_DoDefaultAction(routing_id(), object_id)); } void RenderWidgetHost::AccessibilitySetFocus(int object_id) { - Send(new ViewMsg_SetAccessibilityFocus(routing_id(), object_id)); + Send(new AccessibilityMsg_SetFocus(routing_id(), object_id)); } void RenderWidgetHost::AccessibilityScrollToMakeVisible( int acc_obj_id, gfx::Rect subfocus) { - Send(new ViewMsg_AccessibilityScrollToMakeVisible( + Send(new AccessibilityMsg_ScrollToMakeVisible( routing_id(), acc_obj_id, subfocus)); } void RenderWidgetHost::AccessibilityScrollToPoint( int acc_obj_id, gfx::Point point) { - Send(new ViewMsg_AccessibilityScrollToPoint( + Send(new AccessibilityMsg_ScrollToPoint( routing_id(), acc_obj_id, point)); } void RenderWidgetHost::AccessibilitySetTextSelection( int object_id, int start_offset, int end_offset) { - Send(new ViewMsg_AccessibilitySetTextSelection( + Send(new AccessibilityMsg_SetTextSelection( routing_id(), object_id, start_offset, end_offset)); } diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h index 85144bc..a93fef8 100644 --- a/content/browser/renderer_host/render_widget_host_view.h +++ b/content/browser/renderer_host/render_widget_host_view.h @@ -37,8 +37,8 @@ class BackingStore; class BrowserAccessibilityManager; class RenderWidgetHost; class WebCursor; +struct AccessibilityHostMsg_NotificationParams; struct NativeWebKeyboardEvent; -struct ViewHostMsg_AccessibilityNotification_Params; namespace content { class RenderProcessHost; @@ -348,7 +348,7 @@ class RenderWidgetHostView { const SkBitmap& background() const { return background_; } virtual void OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { + const std::vector<AccessibilityHostMsg_NotificationParams>& params) { } BrowserAccessibilityManager* GetBrowserAccessibilityManager() const; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index 8bbde73..3208611 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -223,7 +223,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params + const std::vector<AccessibilityHostMsg_NotificationParams>& params ) OVERRIDE; virtual void PluginFocusChanged(bool focused, int plugin_id) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 514d488..40ef236 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -28,6 +28,7 @@ #include "content/browser/renderer_host/render_view_host.h" #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h" #import "content/browser/renderer_host/text_input_client_mac.h" +#include "content/common/accessibility_messages.h" #include "content/common/edit_command.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/plugin_messages.h" @@ -1126,7 +1127,7 @@ void RenderWidgetHostViewMac::SetBackground(const SkBitmap& background) { } void RenderWidgetHostViewMac::OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { + const std::vector<AccessibilityHostMsg_NotificationParams>& params) { if (!GetBrowserAccessibilityManager()) { SetBrowserAccessibilityManager( BrowserAccessibilityManager::CreateEmptyDocument( @@ -2039,7 +2040,7 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { - (void)doDefaultAction:(int32)accessibilityObjectId { RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; - rwh->Send(new ViewMsg_AccessibilityDoDefaultAction( + rwh->Send(new AccessibilityMsg_DoDefaultAction( rwh->routing_id(), accessibilityObjectId)); } @@ -2060,7 +2061,7 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { accessibilityId:(int32)accessibilityObjectId { if (focus) { RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; - rwh->Send(new ViewMsg_SetAccessibilityFocus( + rwh->Send(new AccessibilityMsg_SetFocus( rwh->routing_id(), accessibilityObjectId)); } } diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index d567762..33dcc25 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -28,6 +28,7 @@ #include "content/browser/renderer_host/backing_store_win.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host.h" +#include "content/common/accessibility_messages.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" @@ -1912,7 +1913,7 @@ LRESULT RenderWidgetHostViewWin::OnGestureEvent( } void RenderWidgetHostViewWin::OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { + const std::vector<AccessibilityHostMsg_NotificationParams>& params) { if (!GetBrowserAccessibilityManager()) { SetBrowserAccessibilityManager( BrowserAccessibilityManager::CreateEmptyDocument( diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h index 0d235a2..7da9120 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.h +++ b/content/browser/renderer_host/render_widget_host_view_win.h @@ -207,7 +207,7 @@ class RenderWidgetHostViewWin int gpu_host_id) OVERRIDE; virtual void AcceleratedSurfaceSuspend() OVERRIDE; virtual void OnAccessibilityNotifications( - const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params + const std::vector<AccessibilityHostMsg_NotificationParams>& params ) OVERRIDE; virtual bool LockMouse() OVERRIDE; virtual void UnlockMouse() OVERRIDE; diff --git a/content/common/accessibility_messages.h b/content/common/accessibility_messages.h new file mode 100644 index 0000000..a37329e --- /dev/null +++ b/content/common/accessibility_messages.h @@ -0,0 +1,181 @@ +// 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. + +// IPC messages for accessibility. +// Multiply-included message file, hence no include guard. + +#include "base/basictypes.h" +#include "content/common/content_export.h" +#include "content/public/common/common_param_traits.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_message_utils.h" +#include "ipc/ipc_param_traits.h" +#include "ipc/param_traits_macros.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" +#include "webkit/glue/webaccessibility.h" + +#undef IPC_MESSAGE_EXPORT +#define IPC_MESSAGE_EXPORT CONTENT_EXPORT + +#define IPC_MESSAGE_START AccessibilityMsgStart + +#ifndef CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_ +#define CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_ + +enum AccessibilityNotification { + // The active descendant of a node has changed. + AccessibilityNotificationActiveDescendantChanged, + + // An alert appeared. + AccessibilityNotificationAlert, + + // The node checked state has changed. + AccessibilityNotificationCheckStateChanged, + + // The node tree structure has changed. + AccessibilityNotificationChildrenChanged, + + // The node in focus has changed. + AccessibilityNotificationFocusChanged, + + // Page layout has completed. + AccessibilityNotificationLayoutComplete, + + // Content within a part of the page marked as a live region changed. + AccessibilityNotificationLiveRegionChanged, + + // The document node has loaded. + AccessibilityNotificationLoadComplete, + + // A menu list value changed. + AccessibilityNotificationMenuListValueChanged, + + // An object was shown. + AccessibilityNotificationObjectShow, + + // An object was hidden. + AccessibilityNotificationObjectHide, + + // The number of rows in a grid or tree control changed. + AccessibilityNotificationRowCountChanged, + + // A row in a grid or tree control was collapsed. + AccessibilityNotificationRowCollapsed, + + // A row in a grid or tree control was expanded. + AccessibilityNotificationRowExpanded, + + // The document was scrolled to an anchor node. + AccessibilityNotificationScrolledToAnchor, + + // One or more selected children of this node have changed. + AccessibilityNotificationSelectedChildrenChanged, + + // The text cursor or selection changed. + AccessibilityNotificationSelectedTextChanged, + + // Text was inserted in a node with text content. + AccessibilityNotificationTextInserted, + + // Text was removed in a node with text content. + AccessibilityNotificationTextRemoved, + + // The node value has changed. + AccessibilityNotificationValueChangedD, +}; + +#endif // CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_ + +IPC_ENUM_TRAITS(AccessibilityNotification) + +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::BoolAttribute) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::FloatAttribute) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::IntAttribute) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::Role) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::State) +IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::StringAttribute) + +IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebAccessibility) + IPC_STRUCT_TRAITS_MEMBER(id) + IPC_STRUCT_TRAITS_MEMBER(name) + IPC_STRUCT_TRAITS_MEMBER(value) + IPC_STRUCT_TRAITS_MEMBER(role) + IPC_STRUCT_TRAITS_MEMBER(state) + IPC_STRUCT_TRAITS_MEMBER(location) + IPC_STRUCT_TRAITS_MEMBER(string_attributes) + IPC_STRUCT_TRAITS_MEMBER(int_attributes) + IPC_STRUCT_TRAITS_MEMBER(float_attributes) + IPC_STRUCT_TRAITS_MEMBER(bool_attributes) + IPC_STRUCT_TRAITS_MEMBER(children) + IPC_STRUCT_TRAITS_MEMBER(indirect_child_ids) + IPC_STRUCT_TRAITS_MEMBER(html_attributes) + IPC_STRUCT_TRAITS_MEMBER(line_breaks) + IPC_STRUCT_TRAITS_MEMBER(cell_ids) + IPC_STRUCT_TRAITS_MEMBER(unique_cell_ids) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_BEGIN(AccessibilityHostMsg_NotificationParams) + // Type of notification. + IPC_STRUCT_MEMBER(AccessibilityNotification, notification_type) + + // ID of the node that the notification applies to. + IPC_STRUCT_MEMBER(int, id) + + // The accessibility node tree. + IPC_STRUCT_MEMBER(webkit_glue::WebAccessibility, acc_tree) + + // Whether children are included in this tree, otherwise it's just an + // update to this one node and existing children are left in place. + IPC_STRUCT_MEMBER(bool, includes_children) +IPC_STRUCT_END() + +// Messages sent from the browser to the renderer. + +// Enable accessibility in the renderer process. +IPC_MESSAGE_ROUTED0(AccessibilityMsg_Enable) + +// Relay a request from assistive technology to set focus to a given node. +IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetFocus, + int /* object id */) + +// Relay a request from assistive technology to perform the default action +// on a given node. +IPC_MESSAGE_ROUTED1(AccessibilityMsg_DoDefaultAction, + int /* object id */) + +// Relay a request from assistive technology to make a given object +// visible by scrolling as many scrollable containers as possible. +// In addition, if it's not possible to make the entire object visible, +// scroll so that the |subfocus| rect is visible at least. The subfocus +// rect is in local coordinates of the object itself. +IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToMakeVisible, + int /* object id */, + gfx::Rect /* subfocus */) + +// Relay a request from assistive technology to move a given object +// to a specific location, in the tab content area coordinate space, i.e. +// (0, 0) is the top-left corner of the tab contents. +IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToPoint, + int /* object id */, + gfx::Point /* new location */) + +// Relay a request from assistive technology to set the cursor or +// selection within an editable text element. +IPC_MESSAGE_ROUTED3(AccessibilityMsg_SetTextSelection, + int /* object id */, + int /* New start offset */, + int /* New end offset */) + +// Tells the render view that a AccessibilityHostMsg_Notifications +// message was processed and it can send addition notifications. +IPC_MESSAGE_ROUTED0(AccessibilityMsg_Notifications_ACK) + +// Messages sent from the renderer to the browser. + +// Sent to notify the browser about renderer accessibility notifications. +// The browser responds with a AccessibilityMsg_Notifications_ACK. +IPC_MESSAGE_ROUTED1( + AccessibilityHostMsg_Notifications, + std::vector<AccessibilityHostMsg_NotificationParams>) diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index d00867a..0b6b89e 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -6,6 +6,7 @@ #include "content/common/child_process_messages.h" +#include "content/common/accessibility_messages.h" #include "content/common/appcache_messages.h" #include "content/common/clipboard_messages.h" #include "content/common/database_messages.h" diff --git a/content/common/swapped_out_messages.cc b/content/common/swapped_out_messages.cc index c350bc3..45d70f0 100644 --- a/content/common/swapped_out_messages.cc +++ b/content/common/swapped_out_messages.cc @@ -4,6 +4,7 @@ #include "content/common/swapped_out_messages.h" +#include "content/common/accessibility_messages.h" #include "content/common/view_messages.h" #include "content/public/common/content_client.h" @@ -62,7 +63,7 @@ bool SwappedOutMessages::CanHandleWhileSwappedOut( // Sends an ACK. case ViewHostMsg_RequestMove::ID: // Sends an ACK. - case ViewHostMsg_AccessibilityNotifications::ID: + case AccessibilityHostMsg_Notifications::ID: #if defined(USE_X11) // Synchronous message when leaving a page with plugin. In this case, // we want to destroy the plugin rather than return an error message. diff --git a/content/common/view_message_enums.h b/content/common/view_message_enums.h index 75c6868..29761b2 100644 --- a/content/common/view_message_enums.h +++ b/content/common/view_message_enums.h @@ -5,70 +5,6 @@ #ifndef CONTENT_COMMON_VIEW_MESSAGES_ENUMS_H_ #define CONTENT_COMMON_VIEW_MESSAGES_ENUMS_H_ -struct ViewHostMsg_AccEvent { - enum Value { - // The active descendant of a node has changed. - ACTIVE_DESCENDANT_CHANGED, - - // An alert appeared. - ALERT, - - // The node checked state has changed. - CHECK_STATE_CHANGED, - - // The node tree structure has changed. - CHILDREN_CHANGED, - - // The node in focus has changed. - FOCUS_CHANGED, - - // Page layout has completed. - LAYOUT_COMPLETE, - - // Content within a part of the page marked as a live region changed. - LIVE_REGION_CHANGED, - - // The document node has loaded. - LOAD_COMPLETE, - - // A menu list value changed. - MENU_LIST_VALUE_CHANGED, - - // An object was shown. - OBJECT_SHOW, - - // An object was hidden. - OBJECT_HIDE, - - // The number of rows in a grid or tree control changed. - ROW_COUNT_CHANGED, - - // A row in a grid or tree control was collapsed. - ROW_COLLAPSED, - - // A row in a grid or tree control was expanded. - ROW_EXPANDED, - - // The document was scrolled to an anchor node. - SCROLLED_TO_ANCHOR, - - // One or more selected children of this node have changed. - SELECTED_CHILDREN_CHANGED, - - // The text cursor or selection changed. - SELECTED_TEXT_CHANGED, - - // Text was inserted in a node with text content. - TEXT_INSERTED, - - // Text was removed in a node with text content. - TEXT_REMOVED, - - // The node value has changed. - VALUE_CHANGED, - }; -}; - // Values that may be OR'd together to form the 'flags' parameter of a // ViewHostMsg_UpdateRect_Params structure. struct ViewHostMsg_UpdateRect_Flags { diff --git a/content/common/view_messages.h b/content/common/view_messages.h index bafda65..65ca523 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -42,7 +42,6 @@ #include "webkit/glue/webcookie.h" #include "webkit/glue/webmenuitem.h" #include "webkit/glue/webpreferences.h" -#include "webkit/glue/webaccessibility.h" #include "webkit/plugins/npapi/webplugin.h" #if defined(OS_MACOSX) @@ -56,7 +55,6 @@ IPC_ENUM_TRAITS(CSSColors::CSSColorName) IPC_ENUM_TRAITS(NavigationGesture) -IPC_ENUM_TRAITS(ViewHostMsg_AccEvent::Value) IPC_ENUM_TRAITS(ViewMsg_Navigate_Type::Value) IPC_ENUM_TRAITS(WebKit::WebContextMenuData::MediaType) IPC_ENUM_TRAITS(WebKit::WebMediaPlayerAction::Type) @@ -74,12 +72,6 @@ IPC_ENUM_TRAITS(content::StopFindAction) IPC_ENUM_TRAITS(media::MediaLogEvent::Type) IPC_ENUM_TRAITS(ui::TextInputType) IPC_ENUM_TRAITS(ui::JavascriptMessageType) -IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::BoolAttribute) -IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::FloatAttribute) -IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::IntAttribute) -IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::Role) -IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::State) -IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::StringAttribute) IPC_STRUCT_TRAITS_BEGIN(EditCommand) IPC_STRUCT_TRAITS_MEMBER(name) @@ -319,25 +311,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::SSLStatus) IPC_STRUCT_TRAITS_MEMBER(content_status) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebAccessibility) - IPC_STRUCT_TRAITS_MEMBER(id) - IPC_STRUCT_TRAITS_MEMBER(name) - IPC_STRUCT_TRAITS_MEMBER(value) - IPC_STRUCT_TRAITS_MEMBER(role) - IPC_STRUCT_TRAITS_MEMBER(state) - IPC_STRUCT_TRAITS_MEMBER(location) - IPC_STRUCT_TRAITS_MEMBER(string_attributes) - IPC_STRUCT_TRAITS_MEMBER(int_attributes) - IPC_STRUCT_TRAITS_MEMBER(float_attributes) - IPC_STRUCT_TRAITS_MEMBER(bool_attributes) - IPC_STRUCT_TRAITS_MEMBER(children) - IPC_STRUCT_TRAITS_MEMBER(indirect_child_ids) - IPC_STRUCT_TRAITS_MEMBER(html_attributes) - IPC_STRUCT_TRAITS_MEMBER(line_breaks) - IPC_STRUCT_TRAITS_MEMBER(cell_ids) - IPC_STRUCT_TRAITS_MEMBER(unique_cell_ids) -IPC_STRUCT_TRAITS_END() - IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebCookie) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(value) @@ -418,21 +391,6 @@ IPC_STRUCT_BEGIN(ViewHostMsg_CreateWorker_Params) IPC_STRUCT_MEMBER(int64, script_resource_appcache_id) IPC_STRUCT_END() -IPC_STRUCT_BEGIN(ViewHostMsg_AccessibilityNotification_Params) - // Type of notification. - IPC_STRUCT_MEMBER(ViewHostMsg_AccEvent::Value, notification_type) - - // ID of the node that the notification applies to. - IPC_STRUCT_MEMBER(int, id) - - // The accessibility node tree. - IPC_STRUCT_MEMBER(webkit_glue::WebAccessibility, acc_tree) - - // Whether children are included in this tree, otherwise it's just an - // update to this one node and existing children are left in place. - IPC_STRUCT_MEMBER(bool, includes_children) -IPC_STRUCT_END() - // Parameters structure for ViewHostMsg_FrameNavigate, which has too many data // parameters to be reasonably put in a predefined IPC message. IPC_STRUCT_BEGIN_WITH_PARENT(ViewHostMsg_FrameNavigate_Params, @@ -1148,45 +1106,6 @@ IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK, IPC_MESSAGE_CONTROL1(ViewMsg_NetworkStateChanged, bool /* online */) -// Enable accessibility in the renderer process. -IPC_MESSAGE_ROUTED0(ViewMsg_EnableAccessibility) - -// Relay a request from assistive technology to set focus to a given node. -IPC_MESSAGE_ROUTED1(ViewMsg_SetAccessibilityFocus, - int /* object id */) - -// Relay a request from assistive technology to perform the default action -// on a given node. -IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction, - int /* object id */) - -// Relay a request from assistive technology to make a given object -// visible by scrolling as many scrollable containers as possible. -// In addition, if it's not possible to make the entire object visible, -// scroll so that the |subfocus| rect is visible at least. The subfocus -// rect is in local coordinates of the object itself. -IPC_MESSAGE_ROUTED2(ViewMsg_AccessibilityScrollToMakeVisible, - int /* object id */, - gfx::Rect /* subfocus */) - -// Relay a request from assistive technology to move a given object -// to a specific location, in the tab content area coordinate space, i.e. -// (0, 0) is the top-left corner of the tab contents. -IPC_MESSAGE_ROUTED2(ViewMsg_AccessibilityScrollToPoint, - int /* object id */, - gfx::Point /* new location */) - -// Relay a request from assistive technology to set the cursor or -// selection within an editable text element. -IPC_MESSAGE_ROUTED3(ViewMsg_AccessibilitySetTextSelection, - int /* object id */, - int /* New start offset */, - int /* New end offset */) - -// Tells the render view that a ViewHostMsg_AccessibilityNotifications -// message was processed and it can send addition notifications. -IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK) - // Reply to ViewHostMsg_OpenChannelToPpapiBroker // Tells the renderer that the channel to the broker has been created. IPC_MESSAGE_ROUTED3(ViewMsg_PpapiBrokerChannelCreated, @@ -1923,12 +1842,6 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, uint64 /* surface_id */) #endif -// Sent to notify the browser about renderer accessibility notifications. -// The browser responds with a ViewMsg_AccessibilityNotifications_ACK. -IPC_MESSAGE_ROUTED1( - ViewHostMsg_AccessibilityNotifications, - std::vector<ViewHostMsg_AccessibilityNotification_Params>) - // Opens a file asynchronously. The response returns a file descriptor // and an error code from base/platform_file.h. IPC_MESSAGE_ROUTED3(ViewHostMsg_AsyncOpenFile, diff --git a/content/content_common.gypi b/content/content_common.gypi index f118838..b1f4ca5 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -83,6 +83,7 @@ 'public/common/url_fetcher_factory.h', 'public/common/view_type.h', 'public/common/zygote_fork_delegate_linux.h', + 'common/accessibility_messages.h', 'common/appcache/appcache_backend_proxy.cc', 'common/appcache/appcache_backend_proxy.h', 'common/appcache/appcache_dispatcher.cc', diff --git a/content/renderer/renderer_accessibility.cc b/content/renderer/renderer_accessibility.cc index 3b3ac6d..bfadd57 100644 --- a/content/renderer/renderer_accessibility.cc +++ b/content/renderer/renderer_accessibility.cc @@ -4,7 +4,7 @@ #include "base/bind.h" #include "base/command_line.h" -#include "content/common/view_messages.h" +#include "content/common/accessibility_messages.h" #include "content/public/common/content_switches.h" #include "content/renderer/render_view_impl.h" #include "content/renderer/renderer_accessibility.h" @@ -27,54 +27,54 @@ using WebKit::WebSize; using WebKit::WebView; using webkit_glue::WebAccessibility; -bool WebAccessibilityNotificationToViewHostMsg( +bool WebAccessibilityNotificationToAccessibilityNotification( WebAccessibilityNotification notification, - ViewHostMsg_AccEvent::Value* type) { + AccessibilityNotification* type) { switch (notification) { case WebKit::WebAccessibilityNotificationActiveDescendantChanged: - *type = ViewHostMsg_AccEvent::ACTIVE_DESCENDANT_CHANGED; + *type = AccessibilityNotificationActiveDescendantChanged; break; case WebKit::WebAccessibilityNotificationCheckedStateChanged: - *type = ViewHostMsg_AccEvent::CHECK_STATE_CHANGED; + *type = AccessibilityNotificationCheckStateChanged; break; case WebKit::WebAccessibilityNotificationChildrenChanged: - *type = ViewHostMsg_AccEvent::CHILDREN_CHANGED; + *type = AccessibilityNotificationChildrenChanged; break; case WebKit::WebAccessibilityNotificationFocusedUIElementChanged: - *type = ViewHostMsg_AccEvent::FOCUS_CHANGED; + *type = AccessibilityNotificationFocusChanged; break; case WebKit::WebAccessibilityNotificationLayoutComplete: - *type = ViewHostMsg_AccEvent::LAYOUT_COMPLETE; + *type = AccessibilityNotificationLayoutComplete; break; case WebKit::WebAccessibilityNotificationLiveRegionChanged: - *type = ViewHostMsg_AccEvent::LIVE_REGION_CHANGED; + *type = AccessibilityNotificationLiveRegionChanged; break; case WebKit::WebAccessibilityNotificationLoadComplete: - *type = ViewHostMsg_AccEvent::LOAD_COMPLETE; + *type = AccessibilityNotificationLoadComplete; break; case WebKit::WebAccessibilityNotificationMenuListValueChanged: - *type = ViewHostMsg_AccEvent::MENU_LIST_VALUE_CHANGED; + *type = AccessibilityNotificationMenuListValueChanged; break; case WebKit::WebAccessibilityNotificationRowCollapsed: - *type = ViewHostMsg_AccEvent::ROW_COLLAPSED; + *type = AccessibilityNotificationRowCollapsed; break; case WebKit::WebAccessibilityNotificationRowCountChanged: - *type = ViewHostMsg_AccEvent::ROW_COUNT_CHANGED; + *type = AccessibilityNotificationRowCountChanged; break; case WebKit::WebAccessibilityNotificationRowExpanded: - *type = ViewHostMsg_AccEvent::ROW_EXPANDED; + *type = AccessibilityNotificationRowExpanded; break; case WebKit::WebAccessibilityNotificationScrolledToAnchor: - *type = ViewHostMsg_AccEvent::SCROLLED_TO_ANCHOR; + *type = AccessibilityNotificationScrolledToAnchor; break; case WebKit::WebAccessibilityNotificationSelectedChildrenChanged: - *type = ViewHostMsg_AccEvent::SELECTED_CHILDREN_CHANGED; + *type = AccessibilityNotificationSelectedChildrenChanged; break; case WebKit::WebAccessibilityNotificationSelectedTextChanged: - *type = ViewHostMsg_AccEvent::SELECTED_TEXT_CHANGED; + *type = AccessibilityNotificationSelectedTextChanged; break; case WebKit::WebAccessibilityNotificationValueChanged: - *type = ViewHostMsg_AccEvent::VALUE_CHANGED; + *type = AccessibilityNotificationValueChangedD; break; default: NOTREACHED(); @@ -103,17 +103,17 @@ RendererAccessibility::~RendererAccessibility() { bool RendererAccessibility::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(RendererAccessibility, message) - IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) - IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) - IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, - OnAccessibilityDoDefaultAction) - IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, - OnAccessibilityNotificationsAck) - IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityScrollToMakeVisible, + IPC_MESSAGE_HANDLER(AccessibilityMsg_Enable, OnEnable) + IPC_MESSAGE_HANDLER(AccessibilityMsg_SetFocus, OnSetFocus) + IPC_MESSAGE_HANDLER(AccessibilityMsg_DoDefaultAction, + OnDoDefaultAction) + IPC_MESSAGE_HANDLER(AccessibilityMsg_Notifications_ACK, + OnNotificationsAck) + IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToMakeVisible, OnScrollToMakeVisible) - IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityScrollToPoint, + IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToPoint, OnScrollToPoint) - IPC_MESSAGE_HANDLER(ViewMsg_AccessibilitySetTextSelection, + IPC_MESSAGE_HANDLER(AccessibilityMsg_SetTextSelection, OnSetTextSelection) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -187,9 +187,11 @@ void RendererAccessibility::PostAccessibilityNotification( acc_notification.id = obj.axID(); acc_notification.type = notification; - ViewHostMsg_AccEvent::Value temp; - if (!WebAccessibilityNotificationToViewHostMsg(notification, &temp)) + AccessibilityNotification temp; + if (!WebAccessibilityNotificationToAccessibilityNotification( + notification, &temp)) { return; + } // Discard duplicate accessibility notifications. for (uint32 i = 0; i < pending_notifications_.size(); ++i) { @@ -229,7 +231,7 @@ void RendererAccessibility::SendPendingAccessibilityNotifications() { pending_notifications_.clear(); // Generate a notification message from each WebKit notification. - std::vector<ViewHostMsg_AccessibilityNotification_Params> notification_msgs; + std::vector<AccessibilityHostMsg_NotificationParams> notification_msgs; // Loop over each WebKit notification and generate a notification message // from it. @@ -299,8 +301,8 @@ void RendererAccessibility::SendPendingAccessibilityNotifications() { } } - ViewHostMsg_AccessibilityNotification_Params notification_msg; - WebAccessibilityNotificationToViewHostMsg( + AccessibilityHostMsg_NotificationParams notification_msg; + WebAccessibilityNotificationToAccessibilityNotification( notification.type, ¬ification_msg.notification_type); notification_msg.id = notification.id; notification_msg.includes_children = includes_children; @@ -324,8 +326,8 @@ void RendererAccessibility::SendPendingAccessibilityNotifications() { } #endif } - Send(new ViewHostMsg_AccessibilityNotifications(routing_id(), - notification_msgs)); + + Send(new AccessibilityHostMsg_Notifications(routing_id(), notification_msgs)); } void RendererAccessibility::UpdateBrowserTree( @@ -368,7 +370,7 @@ void RendererAccessibility::ClearBrowserTreeNode( browser_node->children.clear(); } -void RendererAccessibility::OnAccessibilityDoDefaultAction(int acc_obj_id) { +void RendererAccessibility::OnDoDefaultAction(int acc_obj_id) { if (!WebAccessibilityObject::accessibilityEnabled()) return; @@ -477,13 +479,13 @@ void RendererAccessibility::OnSetTextSelection( } } -void RendererAccessibility::OnAccessibilityNotificationsAck() { +void RendererAccessibility::OnNotificationsAck() { DCHECK(ack_pending_); ack_pending_ = false; SendPendingAccessibilityNotifications(); } -void RendererAccessibility::OnEnableAccessibility() { +void RendererAccessibility::OnEnable() { if (WebAccessibilityObject::accessibilityEnabled()) return; @@ -500,7 +502,7 @@ void RendererAccessibility::OnEnableAccessibility() { } } -void RendererAccessibility::OnSetAccessibilityFocus(int acc_obj_id) { +void RendererAccessibility::OnSetFocus(int acc_obj_id) { if (!WebAccessibilityObject::accessibilityEnabled()) return; diff --git a/content/renderer/renderer_accessibility.h b/content/renderer/renderer_accessibility.h index 5037cae..835a00f 100644 --- a/content/renderer/renderer_accessibility.h +++ b/content/renderer/renderer_accessibility.h @@ -80,13 +80,13 @@ class RendererAccessibility : public content::RenderViewObserver { void ClearBrowserTreeNode(BrowserTreeNode* browser_node); // Handlers for messages from the browser to the renderer. - void OnAccessibilityDoDefaultAction(int acc_obj_id); - void OnAccessibilityNotificationsAck(); + void OnDoDefaultAction(int acc_obj_id); + void OnNotificationsAck(); void OnChangeScrollPosition(int acc_obj_id, int scroll_x, int scroll_y); void OnScrollToMakeVisible(int acc_obj_id, gfx::Rect subfocus); void OnScrollToPoint(int acc_obj_id, gfx::Point point); - void OnEnableAccessibility(); - void OnSetAccessibilityFocus(int acc_obj_id); + void OnEnable(); + void OnSetFocus(int acc_obj_id); void OnSetTextSelection(int acc_obj_id, int start_offset, int end_offset); diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 9d750ca..80ce912 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -99,6 +99,7 @@ enum IPCMessageStart { JavaBridgeMsgStart, GamepadMsgStart, ShellMsgStart, + AccessibilityMsgStart, LastIPCMsgStart // Must come last. }; |