Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 407493004: Revert of Revert of Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_view_impl_params.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 frames_in_progress_(0), 720 frames_in_progress_(0),
721 target_url_status_(TARGET_NONE), 721 target_url_status_(TARGET_NONE),
722 uses_temporary_zoom_level_(false), 722 uses_temporary_zoom_level_(false),
723 #if defined(OS_ANDROID) 723 #if defined(OS_ANDROID)
724 top_controls_constraints_(cc::BOTH), 724 top_controls_constraints_(cc::BOTH),
725 #endif 725 #endif
726 has_scrolled_focused_editable_node_into_rect_(false), 726 has_scrolled_focused_editable_node_into_rect_(false),
727 speech_recognition_dispatcher_(NULL), 727 speech_recognition_dispatcher_(NULL),
728 browser_plugin_manager_(NULL), 728 browser_plugin_manager_(NULL),
729 devtools_agent_(NULL), 729 devtools_agent_(NULL),
730 accessibility_mode_(AccessibilityModeOff),
731 renderer_accessibility_(NULL),
732 mouse_lock_dispatcher_(NULL), 730 mouse_lock_dispatcher_(NULL),
733 #if defined(OS_ANDROID) 731 #if defined(OS_ANDROID)
734 expected_content_intent_id_(0), 732 expected_content_intent_id_(0),
735 #endif 733 #endif
736 #if defined(OS_WIN) 734 #if defined(OS_WIN)
737 focused_plugin_id_(-1), 735 focused_plugin_id_(-1),
738 #endif 736 #endif
739 #if defined(ENABLE_PLUGINS) 737 #if defined(ENABLE_PLUGINS)
740 plugin_find_handler_(NULL), 738 plugin_find_handler_(NULL),
741 focused_pepper_plugin_(NULL), 739 focused_pepper_plugin_(NULL),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 // The next group of objects all implement RenderViewObserver, so are deleted 852 // The next group of objects all implement RenderViewObserver, so are deleted
855 // along with the RenderView automatically. 853 // along with the RenderView automatically.
856 devtools_agent_ = new DevToolsAgent(this); 854 devtools_agent_ = new DevToolsAgent(this);
857 if (RenderWidgetCompositor* rwc = compositor()) { 855 if (RenderWidgetCompositor* rwc = compositor()) {
858 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); 856 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId());
859 } 857 }
860 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); 858 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this);
861 859
862 history_controller_.reset(new HistoryController(this)); 860 history_controller_.reset(new HistoryController(this));
863 861
864 // Create renderer_accessibility_ if needed.
865 OnSetAccessibilityMode(params->accessibility_mode);
866
867 new IdleUserDetector(this); 862 new IdleUserDetector(this);
868 863
869 if (command_line.HasSwitch(switches::kDomAutomationController)) 864 if (command_line.HasSwitch(switches::kDomAutomationController))
870 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; 865 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION;
871 if (command_line.HasSwitch(switches::kStatsCollectionController)) 866 if (command_line.HasSwitch(switches::kStatsCollectionController))
872 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; 867 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION;
873 868
874 ProcessViewLayoutFlags(command_line); 869 ProcessViewLayoutFlags(command_line);
875 870
876 GetContentClient()->renderer()->RenderViewCreated(this); 871 GetContentClient()->renderer()->RenderViewCreated(this);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 int32 main_frame_routing_id, 1194 int32 main_frame_routing_id,
1200 int32 surface_id, 1195 int32 surface_id,
1201 int64 session_storage_namespace_id, 1196 int64 session_storage_namespace_id,
1202 const base::string16& frame_name, 1197 const base::string16& frame_name,
1203 bool is_renderer_created, 1198 bool is_renderer_created,
1204 bool swapped_out, 1199 bool swapped_out,
1205 int32 proxy_routing_id, 1200 int32 proxy_routing_id,
1206 bool hidden, 1201 bool hidden,
1207 bool never_visible, 1202 bool never_visible,
1208 int32 next_page_id, 1203 int32 next_page_id,
1209 const blink::WebScreenInfo& screen_info, 1204 const blink::WebScreenInfo& screen_info) {
1210 AccessibilityMode accessibility_mode) {
1211 DCHECK(routing_id != MSG_ROUTING_NONE); 1205 DCHECK(routing_id != MSG_ROUTING_NONE);
1212 RenderViewImplParams params(opener_id, 1206 RenderViewImplParams params(opener_id,
1213 window_was_created_with_opener, 1207 window_was_created_with_opener,
1214 renderer_prefs, 1208 renderer_prefs,
1215 webkit_prefs, 1209 webkit_prefs,
1216 routing_id, 1210 routing_id,
1217 main_frame_routing_id, 1211 main_frame_routing_id,
1218 surface_id, 1212 surface_id,
1219 session_storage_namespace_id, 1213 session_storage_namespace_id,
1220 frame_name, 1214 frame_name,
1221 is_renderer_created, 1215 is_renderer_created,
1222 swapped_out, 1216 swapped_out,
1223 proxy_routing_id, 1217 proxy_routing_id,
1224 hidden, 1218 hidden,
1225 never_visible, 1219 never_visible,
1226 next_page_id, 1220 next_page_id,
1227 screen_info, 1221 screen_info);
1228 accessibility_mode);
1229 RenderViewImpl* render_view = NULL; 1222 RenderViewImpl* render_view = NULL;
1230 if (g_create_render_view_impl) 1223 if (g_create_render_view_impl)
1231 render_view = g_create_render_view_impl(&params); 1224 render_view = g_create_render_view_impl(&params);
1232 else 1225 else
1233 render_view = new RenderViewImpl(&params); 1226 render_view = new RenderViewImpl(&params);
1234 1227
1235 render_view->Initialize(&params); 1228 render_view->Initialize(&params);
1236 return render_view; 1229 return render_view;
1237 } 1230 }
1238 1231
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, 1399 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage,
1407 OnGetAllSavableResourceLinksForCurrentPage) 1400 OnGetAllSavableResourceLinksForCurrentPage)
1408 IPC_MESSAGE_HANDLER( 1401 IPC_MESSAGE_HANDLER(
1409 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, 1402 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
1410 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 1403 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
1411 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) 1404 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu)
1412 // TODO(viettrungluu): Move to a separate message filter. 1405 // TODO(viettrungluu): Move to a separate message filter.
1413 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 1406 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
1414 OnSetHistoryLengthAndPrune) 1407 OnSetHistoryLengthAndPrune)
1415 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1408 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1416 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode)
1417 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) 1409 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener)
1418 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, 1410 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap,
1419 OnReleaseDisambiguationPopupBitmap) 1411 OnReleaseDisambiguationPopupBitmap)
1420 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, 1412 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted,
1421 OnWindowSnapshotCompleted) 1413 OnWindowSnapshotCompleted)
1422 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) 1414 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw)
1423 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1415 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1424 #if defined(OS_ANDROID) 1416 #if defined(OS_ANDROID)
1425 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1417 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1426 OnActivateNearestFindResult) 1418 OnActivateNearestFindResult)
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 main_frame_routing_id, 1740 main_frame_routing_id,
1749 surface_id, 1741 surface_id,
1750 cloned_session_storage_namespace_id, 1742 cloned_session_storage_namespace_id,
1751 base::string16(), // WebCore will take care of setting the correct name. 1743 base::string16(), // WebCore will take care of setting the correct name.
1752 true, // is_renderer_created 1744 true, // is_renderer_created
1753 false, // swapped_out 1745 false, // swapped_out
1754 MSG_ROUTING_NONE, // proxy_routing_id 1746 MSG_ROUTING_NONE, // proxy_routing_id
1755 params.disposition == NEW_BACKGROUND_TAB, // hidden 1747 params.disposition == NEW_BACKGROUND_TAB, // hidden
1756 never_visible, 1748 never_visible,
1757 1, // next_page_id 1749 1, // next_page_id
1758 screen_info_, 1750 screen_info_);
1759 accessibility_mode_);
1760 view->opened_by_user_gesture_ = params.user_gesture; 1751 view->opened_by_user_gesture_ = params.user_gesture;
1761 1752
1762 // Record whether the creator frame is trying to suppress the opener field. 1753 // Record whether the creator frame is trying to suppress the opener field.
1763 view->opener_suppressed_ = params.opener_suppressed; 1754 view->opener_suppressed_ = params.opener_suppressed;
1764 1755
1765 return view->webview(); 1756 return view->webview();
1766 } 1757 }
1767 1758
1768 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { 1759 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) {
1769 RenderWidget* widget = 1760 RenderWidget* widget =
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 void RenderViewImpl::focusPrevious() { 2024 void RenderViewImpl::focusPrevious() {
2034 Send(new ViewHostMsg_TakeFocus(routing_id_, true)); 2025 Send(new ViewHostMsg_TakeFocus(routing_id_, true));
2035 } 2026 }
2036 2027
2037 void RenderViewImpl::focusedNodeChanged(const WebNode& node) { 2028 void RenderViewImpl::focusedNodeChanged(const WebNode& node) {
2038 has_scrolled_focused_editable_node_into_rect_ = false; 2029 has_scrolled_focused_editable_node_into_rect_ = false;
2039 2030
2040 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node))); 2031 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node)));
2041 2032
2042 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); 2033 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node));
2034
2035 // TODO(dmazzoni): this should be part of RenderFrameObserver.
2036 main_render_frame()->FocusedNodeChanged(node);
2043 } 2037 }
2044 2038
2045 void RenderViewImpl::didUpdateLayout() { 2039 void RenderViewImpl::didUpdateLayout() {
2046 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout()); 2040 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout());
2047 2041
2048 // We don't always want to set up a timer, only if we've been put in that 2042 // We don't always want to set up a timer, only if we've been put in that
2049 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| 2043 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode|
2050 // message. 2044 // message.
2051 if (!send_preferred_size_changes_ || !webview()) 2045 if (!send_preferred_size_changes_ || !webview())
2052 return; 2046 return;
(...skipping 12 matching lines...) Expand all
2065 int RenderViewImpl::historyBackListCount() { 2059 int RenderViewImpl::historyBackListCount() {
2066 return history_list_offset_ < 0 ? 0 : history_list_offset_; 2060 return history_list_offset_ < 0 ? 0 : history_list_offset_;
2067 } 2061 }
2068 2062
2069 int RenderViewImpl::historyForwardListCount() { 2063 int RenderViewImpl::historyForwardListCount() {
2070 return history_list_length_ - historyBackListCount() - 1; 2064 return history_list_length_ - historyBackListCount() - 1;
2071 } 2065 }
2072 2066
2073 void RenderViewImpl::postAccessibilityEvent( 2067 void RenderViewImpl::postAccessibilityEvent(
2074 const WebAXObject& obj, blink::WebAXEvent event) { 2068 const WebAXObject& obj, blink::WebAXEvent event) {
2075 if (renderer_accessibility_) { 2069 main_render_frame()->HandleWebAccessibilityEvent(obj, event);
2076 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event);
2077 }
2078 } 2070 }
2079 2071
2080 void RenderViewImpl::didUpdateInspectorSetting(const WebString& key, 2072 void RenderViewImpl::didUpdateInspectorSetting(const WebString& key,
2081 const WebString& value) { 2073 const WebString& value) {
2082 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_, 2074 Send(new ViewHostMsg_UpdateInspectorSetting(routing_id_,
2083 key.utf8(), 2075 key.utf8(),
2084 value.utf8())); 2076 value.utf8()));
2085 } 2077 }
2086 2078
2087 // blink::WebWidgetClient ---------------------------------------------------- 2079 // blink::WebWidgetClient ----------------------------------------------------
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3414 webview()->clearFocusedElement(); 3406 webview()->clearFocusedElement();
3415 } 3407 }
3416 3408
3417 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) { 3409 void RenderViewImpl::OnSetBackgroundOpaque(bool opaque) {
3418 if (webview()) 3410 if (webview())
3419 webview()->setIsTransparent(!opaque); 3411 webview()->setIsTransparent(!opaque);
3420 if (compositor_) 3412 if (compositor_)
3421 compositor_->setHasTransparentBackground(!opaque); 3413 compositor_->setHasTransparentBackground(!opaque);
3422 } 3414 }
3423 3415
3424 void RenderViewImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) {
3425 if (accessibility_mode_ == new_mode)
3426 return;
3427 accessibility_mode_ = new_mode;
3428 if (renderer_accessibility_) {
3429 delete renderer_accessibility_;
3430 renderer_accessibility_ = NULL;
3431 }
3432 if (accessibility_mode_ == AccessibilityModeOff)
3433 return;
3434
3435 if (accessibility_mode_ & AccessibilityModeFlagFullTree)
3436 renderer_accessibility_ = new RendererAccessibilityComplete(this);
3437 #if !defined(OS_ANDROID)
3438 else
3439 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this);
3440 #endif
3441 }
3442
3443 void RenderViewImpl::OnSetActive(bool active) { 3416 void RenderViewImpl::OnSetActive(bool active) {
3444 if (webview()) 3417 if (webview())
3445 webview()->setIsActive(active); 3418 webview()->setIsActive(active);
3446 3419
3447 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX) 3420 #if defined(ENABLE_PLUGINS) && defined(OS_MACOSX)
3448 std::set<WebPluginDelegateProxy*>::iterator plugin_it; 3421 std::set<WebPluginDelegateProxy*>::iterator plugin_it;
3449 for (plugin_it = plugin_delegates_.begin(); 3422 for (plugin_it = plugin_delegates_.begin();
3450 plugin_it != plugin_delegates_.end(); ++plugin_it) { 3423 plugin_it != plugin_delegates_.end(); ++plugin_it) {
3451 (*plugin_it)->SetWindowFocus(active); 3424 (*plugin_it)->SetWindowFocus(active);
3452 } 3425 }
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4127 if (main_frame && main_frame->opener()) 4100 if (main_frame && main_frame->opener())
4128 main_frame->setOpener(NULL); 4101 main_frame->setOpener(NULL);
4129 } 4102 }
4130 4103
4131 #if defined(OS_ANDROID) 4104 #if defined(OS_ANDROID)
4132 bool RenderViewImpl::didTapMultipleTargets( 4105 bool RenderViewImpl::didTapMultipleTargets(
4133 const blink::WebGestureEvent& event, 4106 const blink::WebGestureEvent& event,
4134 const WebVector<WebRect>& target_rects) { 4107 const WebVector<WebRect>& target_rects) {
4135 // Never show a disambiguation popup when accessibility is enabled, 4108 // Never show a disambiguation popup when accessibility is enabled,
4136 // as this interferes with "touch exploration". 4109 // as this interferes with "touch exploration".
4137 bool matchesAccessibilityModeComplete = 4110 AccessibilityMode accessibility_mode =
4138 (accessibility_mode_ & AccessibilityModeComplete) == 4111 main_render_frame()->accessibility_mode();
4139 AccessibilityModeComplete; 4112 bool matches_accessibility_mode_complete =
4140 if (matchesAccessibilityModeComplete) 4113 (accessibility_mode & AccessibilityModeComplete) ==
4114 AccessibilityModeComplete;
4115 if (matches_accessibility_mode_complete)
4141 return false; 4116 return false;
4142 4117
4143 gfx::Rect finger_rect( 4118 gfx::Rect finger_rect(
4144 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, 4119 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2,
4145 event.data.tap.width, event.data.tap.height); 4120 event.data.tap.width, event.data.tap.height);
4146 gfx::Rect zoom_rect; 4121 gfx::Rect zoom_rect;
4147 float new_total_scale = 4122 float new_total_scale =
4148 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( 4123 DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor(
4149 finger_rect, target_rects, GetSize(), 4124 finger_rect, target_rects, GetSize(),
4150 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(), 4125 gfx::Rect(webview()->mainFrame()->visibleContentRect()).size(),
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4295 std::vector<gfx::Size> sizes; 4270 std::vector<gfx::Size> sizes;
4296 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4271 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4297 if (!url.isEmpty()) 4272 if (!url.isEmpty())
4298 urls.push_back( 4273 urls.push_back(
4299 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4274 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4300 } 4275 }
4301 SendUpdateFaviconURL(urls); 4276 SendUpdateFaviconURL(urls);
4302 } 4277 }
4303 4278
4304 } // namespace content 4279 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_view_impl_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698