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

Side by Side Diff: content/renderer/render_frame_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_frame_impl.h ('k') | content/renderer/render_thread_impl.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 29 matching lines...) Expand all
40 #include "content/public/common/content_switches.h" 40 #include "content/public/common/content_switches.h"
41 #include "content/public/common/context_menu_params.h" 41 #include "content/public/common/context_menu_params.h"
42 #include "content/public/common/url_constants.h" 42 #include "content/public/common/url_constants.h"
43 #include "content/public/common/url_utils.h" 43 #include "content/public/common/url_utils.h"
44 #include "content/public/renderer/content_renderer_client.h" 44 #include "content/public/renderer/content_renderer_client.h"
45 #include "content/public/renderer/context_menu_client.h" 45 #include "content/public/renderer/context_menu_client.h"
46 #include "content/public/renderer/document_state.h" 46 #include "content/public/renderer/document_state.h"
47 #include "content/public/renderer/navigation_state.h" 47 #include "content/public/renderer/navigation_state.h"
48 #include "content/public/renderer/render_frame_observer.h" 48 #include "content/public/renderer/render_frame_observer.h"
49 #include "content/renderer/accessibility/renderer_accessibility.h" 49 #include "content/renderer/accessibility/renderer_accessibility.h"
50 #include "content/renderer/accessibility/renderer_accessibility_complete.h"
51 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h"
50 #include "content/renderer/browser_plugin/browser_plugin.h" 52 #include "content/renderer/browser_plugin/browser_plugin.h"
51 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 53 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
52 #include "content/renderer/child_frame_compositing_helper.h" 54 #include "content/renderer/child_frame_compositing_helper.h"
53 #include "content/renderer/context_menu_params_builder.h" 55 #include "content/renderer/context_menu_params_builder.h"
54 #include "content/renderer/devtools/devtools_agent.h" 56 #include "content/renderer/devtools/devtools_agent.h"
55 #include "content/renderer/dom_automation_controller.h" 57 #include "content/renderer/dom_automation_controller.h"
56 #include "content/renderer/geolocation_dispatcher.h" 58 #include "content/renderer/geolocation_dispatcher.h"
57 #include "content/renderer/history_controller.h" 59 #include "content/renderer/history_controller.h"
58 #include "content/renderer/history_serialization.h" 60 #include "content/renderer/history_serialization.h"
59 #include "content/renderer/image_loading_helper.h" 61 #include "content/renderer/image_loading_helper.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 #endif 406 #endif
405 #if defined(ENABLE_BROWSER_CDMS) 407 #if defined(ENABLE_BROWSER_CDMS)
406 cdm_manager_(NULL), 408 cdm_manager_(NULL),
407 #endif 409 #endif
408 #if defined(VIDEO_HOLE) 410 #if defined(VIDEO_HOLE)
409 contains_media_player_(false), 411 contains_media_player_(false),
410 #endif 412 #endif
411 geolocation_dispatcher_(NULL), 413 geolocation_dispatcher_(NULL),
412 push_messaging_dispatcher_(NULL), 414 push_messaging_dispatcher_(NULL),
413 screen_orientation_dispatcher_(NULL), 415 screen_orientation_dispatcher_(NULL),
416 accessibility_mode_(AccessibilityModeOff),
417 renderer_accessibility_(NULL),
414 weak_factory_(this) { 418 weak_factory_(this) {
415 std::pair<RoutingIDFrameMap::iterator, bool> result = 419 std::pair<RoutingIDFrameMap::iterator, bool> result =
416 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); 420 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this));
417 CHECK(result.second) << "Inserting a duplicate item."; 421 CHECK(result.second) << "Inserting a duplicate item.";
418 422
419 RenderThread::Get()->AddRoute(routing_id_, this); 423 RenderThread::Get()->AddRoute(routing_id_, this);
420 424
421 render_view_->RegisterRenderFrame(this); 425 render_view_->RegisterRenderFrame(this);
422 426
423 #if defined(OS_ANDROID) 427 #if defined(OS_ANDROID)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 render_view_->set_pepper_last_mouse_event_target(instance); 498 render_view_->set_pepper_last_mouse_event_target(instance);
495 } 499 }
496 500
497 void RenderFrameImpl::PepperTextInputTypeChanged( 501 void RenderFrameImpl::PepperTextInputTypeChanged(
498 PepperPluginInstanceImpl* instance) { 502 PepperPluginInstanceImpl* instance) {
499 if (instance != render_view_->focused_pepper_plugin()) 503 if (instance != render_view_->focused_pepper_plugin())
500 return; 504 return;
501 505
502 GetRenderWidget()->UpdateTextInputState( 506 GetRenderWidget()->UpdateTextInputState(
503 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); 507 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME);
504 if (render_view_->renderer_accessibility()) 508 if (renderer_accessibility())
505 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); 509 renderer_accessibility()->FocusedNodeChanged(WebNode());
506 } 510 }
507 511
508 void RenderFrameImpl::PepperCaretPositionChanged( 512 void RenderFrameImpl::PepperCaretPositionChanged(
509 PepperPluginInstanceImpl* instance) { 513 PepperPluginInstanceImpl* instance) {
510 if (instance != render_view_->focused_pepper_plugin()) 514 if (instance != render_view_->focused_pepper_plugin())
511 return; 515 return;
512 GetRenderWidget()->UpdateSelectionBounds(); 516 GetRenderWidget()->UpdateSelectionBounds();
513 } 517 }
514 518
515 void RenderFrameImpl::PepperCancelComposition( 519 void RenderFrameImpl::PepperCancelComposition(
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) 720 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest)
717 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, 721 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest,
718 OnJavaScriptExecuteRequest) 722 OnJavaScriptExecuteRequest)
719 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, 723 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets,
720 OnSetEditableSelectionOffsets) 724 OnSetEditableSelectionOffsets)
721 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) 725 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload)
722 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, 726 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest,
723 OnTextSurroundingSelectionRequest) 727 OnTextSurroundingSelectionRequest)
724 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, 728 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL,
725 OnAddStyleSheetByURL) 729 OnAddStyleSheetByURL)
730 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode,
731 OnSetAccessibilityMode)
726 #if defined(OS_MACOSX) 732 #if defined(OS_MACOSX)
727 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) 733 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard)
728 #endif 734 #endif
729 IPC_END_MESSAGE_MAP() 735 IPC_END_MESSAGE_MAP()
730 736
731 return handled; 737 return handled;
732 } 738 }
733 739
734 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { 740 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) {
735 MaybeHandleDebugURL(params.url); 741 MaybeHandleDebugURL(params.url);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 frame_->setCompositionFromExistingText(start, end, underlines); 1177 frame_->setCompositionFromExistingText(start, end, underlines);
1172 } 1178 }
1173 1179
1174 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { 1180 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) {
1175 if (!GetRenderWidget()->ShouldHandleImeEvent()) 1181 if (!GetRenderWidget()->ShouldHandleImeEvent())
1176 return; 1182 return;
1177 ImeEventGuard guard(GetRenderWidget()); 1183 ImeEventGuard guard(GetRenderWidget());
1178 frame_->extendSelectionAndDelete(before, after); 1184 frame_->extendSelectionAndDelete(before, after);
1179 } 1185 }
1180 1186
1187 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) {
1188 if (accessibility_mode_ == new_mode)
1189 return;
1190 accessibility_mode_ = new_mode;
1191 if (renderer_accessibility_) {
1192 delete renderer_accessibility_;
1193 renderer_accessibility_ = NULL;
1194 }
1195 if (accessibility_mode_ == AccessibilityModeOff)
1196 return;
1197
1198 if (accessibility_mode_ & AccessibilityModeFlagFullTree)
1199 renderer_accessibility_ = new RendererAccessibilityComplete(this);
1200 #if !defined(OS_ANDROID)
1201 else
1202 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this);
1203 #endif
1204 }
1205
1181 void RenderFrameImpl::OnReload(bool ignore_cache) { 1206 void RenderFrameImpl::OnReload(bool ignore_cache) {
1182 frame_->reload(ignore_cache); 1207 frame_->reload(ignore_cache);
1183 } 1208 }
1184 1209
1185 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { 1210 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) {
1186 blink::WebSurroundingText surroundingText; 1211 blink::WebSurroundingText surroundingText;
1187 surroundingText.initialize(frame_->selectionRange(), max_length); 1212 surroundingText.initialize(frame_->selectionRange(), max_length);
1188 1213
1189 if (surroundingText.isNull()) { 1214 if (surroundingText.isNull()) {
1190 // |surroundingText| might not be correctly initialized, for example if 1215 // |surroundingText| might not be correctly initialized, for example if
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 3153
3129 void RenderFrameImpl::didStopLoading() { 3154 void RenderFrameImpl::didStopLoading() {
3130 render_view_->FrameDidStopLoading(frame_); 3155 render_view_->FrameDidStopLoading(frame_);
3131 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 3156 Send(new FrameHostMsg_DidStopLoading(routing_id_));
3132 } 3157 }
3133 3158
3134 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { 3159 void RenderFrameImpl::didChangeLoadProgress(double load_progress) {
3135 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); 3160 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress));
3136 } 3161 }
3137 3162
3163 void RenderFrameImpl::HandleWebAccessibilityEvent(
3164 const blink::WebAXObject& obj, blink::WebAXEvent event) {
3165 if (renderer_accessibility_)
3166 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event);
3167 }
3168
3169 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) {
3170 if (renderer_accessibility_)
3171 renderer_accessibility_->FocusedNodeChanged(node);
3172 }
3173
3138 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( 3174 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
3139 RenderFrame* render_frame, 3175 RenderFrame* render_frame,
3140 WebFrame* frame, 3176 WebFrame* frame,
3141 WebDataSource::ExtraData* extraData, 3177 WebDataSource::ExtraData* extraData,
3142 const WebURLRequest& request, 3178 const WebURLRequest& request,
3143 WebNavigationType type, 3179 WebNavigationType type,
3144 WebNavigationPolicy default_policy, 3180 WebNavigationPolicy default_policy,
3145 bool is_redirect) { 3181 bool is_redirect) {
3146 #ifdef OS_ANDROID 3182 #ifdef OS_ANDROID
3147 // The handlenavigation API is deprecated and will be removed once 3183 // The handlenavigation API is deprecated and will be removed once
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 3603
3568 #if defined(ENABLE_BROWSER_CDMS) 3604 #if defined(ENABLE_BROWSER_CDMS)
3569 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 3605 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
3570 if (!cdm_manager_) 3606 if (!cdm_manager_)
3571 cdm_manager_ = new RendererCdmManager(this); 3607 cdm_manager_ = new RendererCdmManager(this);
3572 return cdm_manager_; 3608 return cdm_manager_;
3573 } 3609 }
3574 #endif // defined(ENABLE_BROWSER_CDMS) 3610 #endif // defined(ENABLE_BROWSER_CDMS)
3575 3611
3576 } // namespace content 3612 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698