OLD | NEW |
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 Loading... |
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 #endif | 407 #endif |
406 #if defined(ENABLE_BROWSER_CDMS) | 408 #if defined(ENABLE_BROWSER_CDMS) |
407 cdm_manager_(NULL), | 409 cdm_manager_(NULL), |
408 #endif | 410 #endif |
409 #if defined(VIDEO_HOLE) | 411 #if defined(VIDEO_HOLE) |
410 contains_media_player_(false), | 412 contains_media_player_(false), |
411 #endif | 413 #endif |
412 geolocation_dispatcher_(NULL), | 414 geolocation_dispatcher_(NULL), |
413 push_messaging_dispatcher_(NULL), | 415 push_messaging_dispatcher_(NULL), |
414 screen_orientation_dispatcher_(NULL), | 416 screen_orientation_dispatcher_(NULL), |
| 417 accessibility_mode_(AccessibilityModeOff), |
| 418 renderer_accessibility_(NULL), |
415 weak_factory_(this) { | 419 weak_factory_(this) { |
416 std::pair<RoutingIDFrameMap::iterator, bool> result = | 420 std::pair<RoutingIDFrameMap::iterator, bool> result = |
417 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); | 421 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
418 CHECK(result.second) << "Inserting a duplicate item."; | 422 CHECK(result.second) << "Inserting a duplicate item."; |
419 | 423 |
420 RenderThread::Get()->AddRoute(routing_id_, this); | 424 RenderThread::Get()->AddRoute(routing_id_, this); |
421 | 425 |
422 render_view_->RegisterRenderFrame(this); | 426 render_view_->RegisterRenderFrame(this); |
423 | 427 |
424 #if defined(OS_ANDROID) | 428 #if defined(OS_ANDROID) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 render_view_->set_pepper_last_mouse_event_target(instance); | 499 render_view_->set_pepper_last_mouse_event_target(instance); |
496 } | 500 } |
497 | 501 |
498 void RenderFrameImpl::PepperTextInputTypeChanged( | 502 void RenderFrameImpl::PepperTextInputTypeChanged( |
499 PepperPluginInstanceImpl* instance) { | 503 PepperPluginInstanceImpl* instance) { |
500 if (instance != render_view_->focused_pepper_plugin()) | 504 if (instance != render_view_->focused_pepper_plugin()) |
501 return; | 505 return; |
502 | 506 |
503 GetRenderWidget()->UpdateTextInputState( | 507 GetRenderWidget()->UpdateTextInputState( |
504 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); | 508 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); |
505 if (render_view_->renderer_accessibility()) | 509 if (renderer_accessibility()) |
506 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); | 510 renderer_accessibility()->FocusedNodeChanged(WebNode()); |
507 } | 511 } |
508 | 512 |
509 void RenderFrameImpl::PepperCaretPositionChanged( | 513 void RenderFrameImpl::PepperCaretPositionChanged( |
510 PepperPluginInstanceImpl* instance) { | 514 PepperPluginInstanceImpl* instance) { |
511 if (instance != render_view_->focused_pepper_plugin()) | 515 if (instance != render_view_->focused_pepper_plugin()) |
512 return; | 516 return; |
513 GetRenderWidget()->UpdateSelectionBounds(); | 517 GetRenderWidget()->UpdateSelectionBounds(); |
514 } | 518 } |
515 | 519 |
516 void RenderFrameImpl::PepperCancelComposition( | 520 void RenderFrameImpl::PepperCancelComposition( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 714 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
711 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 715 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
712 OnJavaScriptExecuteRequest) | 716 OnJavaScriptExecuteRequest) |
713 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 717 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
714 OnSetEditableSelectionOffsets) | 718 OnSetEditableSelectionOffsets) |
715 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 719 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
716 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 720 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
717 OnTextSurroundingSelectionRequest) | 721 OnTextSurroundingSelectionRequest) |
718 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, | 722 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, |
719 OnAddStyleSheetByURL) | 723 OnAddStyleSheetByURL) |
| 724 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 725 OnSetAccessibilityMode) |
720 #if defined(OS_MACOSX) | 726 #if defined(OS_MACOSX) |
721 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 727 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
722 #endif | 728 #endif |
723 IPC_END_MESSAGE_MAP() | 729 IPC_END_MESSAGE_MAP() |
724 | 730 |
725 return handled; | 731 return handled; |
726 } | 732 } |
727 | 733 |
728 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 734 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
729 MaybeHandleDebugURL(params.url); | 735 MaybeHandleDebugURL(params.url); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 frame_->setCompositionFromExistingText(start, end, underlines); | 1166 frame_->setCompositionFromExistingText(start, end, underlines); |
1161 } | 1167 } |
1162 | 1168 |
1163 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1169 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
1164 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1170 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
1165 return; | 1171 return; |
1166 ImeEventGuard guard(GetRenderWidget()); | 1172 ImeEventGuard guard(GetRenderWidget()); |
1167 frame_->extendSelectionAndDelete(before, after); | 1173 frame_->extendSelectionAndDelete(before, after); |
1168 } | 1174 } |
1169 | 1175 |
| 1176 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
| 1177 if (accessibility_mode_ == new_mode) |
| 1178 return; |
| 1179 accessibility_mode_ = new_mode; |
| 1180 if (renderer_accessibility_) { |
| 1181 delete renderer_accessibility_; |
| 1182 renderer_accessibility_ = NULL; |
| 1183 } |
| 1184 if (accessibility_mode_ == AccessibilityModeOff) |
| 1185 return; |
| 1186 |
| 1187 if (accessibility_mode_ & AccessibilityModeFlagFullTree) |
| 1188 renderer_accessibility_ = new RendererAccessibilityComplete(this); |
| 1189 #if !defined(OS_ANDROID) |
| 1190 else |
| 1191 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); |
| 1192 #endif |
| 1193 } |
| 1194 |
1170 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1195 void RenderFrameImpl::OnReload(bool ignore_cache) { |
1171 frame_->reload(ignore_cache); | 1196 frame_->reload(ignore_cache); |
1172 } | 1197 } |
1173 | 1198 |
1174 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { | 1199 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { |
1175 blink::WebSurroundingText surroundingText; | 1200 blink::WebSurroundingText surroundingText; |
1176 surroundingText.initialize(frame_->selectionRange(), max_length); | 1201 surroundingText.initialize(frame_->selectionRange(), max_length); |
1177 | 1202 |
1178 if (surroundingText.isNull()) { | 1203 if (surroundingText.isNull()) { |
1179 // |surroundingText| might not be correctly initialized, for example if | 1204 // |surroundingText| might not be correctly initialized, for example if |
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3129 | 3154 |
3130 void RenderFrameImpl::didStopLoading() { | 3155 void RenderFrameImpl::didStopLoading() { |
3131 render_view_->FrameDidStopLoading(frame_); | 3156 render_view_->FrameDidStopLoading(frame_); |
3132 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3157 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
3133 } | 3158 } |
3134 | 3159 |
3135 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3160 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
3136 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 3161 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
3137 } | 3162 } |
3138 | 3163 |
| 3164 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 3165 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 3166 if (renderer_accessibility_) |
| 3167 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 3168 } |
| 3169 |
| 3170 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 3171 if (renderer_accessibility_) |
| 3172 renderer_accessibility_->FocusedNodeChanged(node); |
| 3173 } |
| 3174 |
3139 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3175 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
3140 RenderFrame* render_frame, | 3176 RenderFrame* render_frame, |
3141 WebFrame* frame, | 3177 WebFrame* frame, |
3142 WebDataSource::ExtraData* extraData, | 3178 WebDataSource::ExtraData* extraData, |
3143 const WebURLRequest& request, | 3179 const WebURLRequest& request, |
3144 WebNavigationType type, | 3180 WebNavigationType type, |
3145 WebNavigationPolicy default_policy, | 3181 WebNavigationPolicy default_policy, |
3146 bool is_redirect) { | 3182 bool is_redirect) { |
3147 #ifdef OS_ANDROID | 3183 #ifdef OS_ANDROID |
3148 // The handlenavigation API is deprecated and will be removed once | 3184 // The handlenavigation API is deprecated and will be removed once |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3579 | 3615 |
3580 #if defined(ENABLE_BROWSER_CDMS) | 3616 #if defined(ENABLE_BROWSER_CDMS) |
3581 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3617 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3582 if (!cdm_manager_) | 3618 if (!cdm_manager_) |
3583 cdm_manager_ = new RendererCdmManager(this); | 3619 cdm_manager_ = new RendererCdmManager(this); |
3584 return cdm_manager_; | 3620 return cdm_manager_; |
3585 } | 3621 } |
3586 #endif // defined(ENABLE_BROWSER_CDMS) | 3622 #endif // defined(ENABLE_BROWSER_CDMS) |
3587 | 3623 |
3588 } // namespace content | 3624 } // namespace content |
OLD | NEW |