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 30 matching lines...) Expand all Loading... |
41 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_switches.h" |
42 #include "content/public/common/context_menu_params.h" | 42 #include "content/public/common/context_menu_params.h" |
43 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
44 #include "content/public/common/url_utils.h" | 44 #include "content/public/common/url_utils.h" |
45 #include "content/public/renderer/content_renderer_client.h" | 45 #include "content/public/renderer/content_renderer_client.h" |
46 #include "content/public/renderer/context_menu_client.h" | 46 #include "content/public/renderer/context_menu_client.h" |
47 #include "content/public/renderer/document_state.h" | 47 #include "content/public/renderer/document_state.h" |
48 #include "content/public/renderer/navigation_state.h" | 48 #include "content/public/renderer/navigation_state.h" |
49 #include "content/public/renderer/render_frame_observer.h" | 49 #include "content/public/renderer/render_frame_observer.h" |
50 #include "content/renderer/accessibility/renderer_accessibility.h" | 50 #include "content/renderer/accessibility/renderer_accessibility.h" |
| 51 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
| 52 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" |
51 #include "content/renderer/browser_plugin/browser_plugin.h" | 53 #include "content/renderer/browser_plugin/browser_plugin.h" |
52 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 54 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
53 #include "content/renderer/child_frame_compositing_helper.h" | 55 #include "content/renderer/child_frame_compositing_helper.h" |
54 #include "content/renderer/context_menu_params_builder.h" | 56 #include "content/renderer/context_menu_params_builder.h" |
55 #include "content/renderer/devtools/devtools_agent.h" | 57 #include "content/renderer/devtools/devtools_agent.h" |
56 #include "content/renderer/dom_automation_controller.h" | 58 #include "content/renderer/dom_automation_controller.h" |
57 #include "content/renderer/dom_utils.h" | 59 #include "content/renderer/dom_utils.h" |
58 #include "content/renderer/geolocation_dispatcher.h" | 60 #include "content/renderer/geolocation_dispatcher.h" |
59 #include "content/renderer/history_controller.h" | 61 #include "content/renderer/history_controller.h" |
60 #include "content/renderer/history_serialization.h" | 62 #include "content/renderer/history_serialization.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 #endif | 412 #endif |
411 #if defined(ENABLE_BROWSER_CDMS) | 413 #if defined(ENABLE_BROWSER_CDMS) |
412 cdm_manager_(NULL), | 414 cdm_manager_(NULL), |
413 #endif | 415 #endif |
414 #if defined(VIDEO_HOLE) | 416 #if defined(VIDEO_HOLE) |
415 contains_media_player_(false), | 417 contains_media_player_(false), |
416 #endif | 418 #endif |
417 geolocation_dispatcher_(NULL), | 419 geolocation_dispatcher_(NULL), |
418 push_messaging_dispatcher_(NULL), | 420 push_messaging_dispatcher_(NULL), |
419 screen_orientation_dispatcher_(NULL), | 421 screen_orientation_dispatcher_(NULL), |
| 422 accessibility_mode_(AccessibilityModeOff), |
| 423 renderer_accessibility_(NULL), |
420 weak_factory_(this) { | 424 weak_factory_(this) { |
421 std::pair<RoutingIDFrameMap::iterator, bool> result = | 425 std::pair<RoutingIDFrameMap::iterator, bool> result = |
422 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); | 426 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
423 CHECK(result.second) << "Inserting a duplicate item."; | 427 CHECK(result.second) << "Inserting a duplicate item."; |
424 | 428 |
425 RenderThread::Get()->AddRoute(routing_id_, this); | 429 RenderThread::Get()->AddRoute(routing_id_, this); |
426 | 430 |
427 render_view_->RegisterRenderFrame(this); | 431 render_view_->RegisterRenderFrame(this); |
428 | 432 |
429 #if defined(OS_ANDROID) | 433 #if defined(OS_ANDROID) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 render_view_->set_pepper_last_mouse_event_target(instance); | 504 render_view_->set_pepper_last_mouse_event_target(instance); |
501 } | 505 } |
502 | 506 |
503 void RenderFrameImpl::PepperTextInputTypeChanged( | 507 void RenderFrameImpl::PepperTextInputTypeChanged( |
504 PepperPluginInstanceImpl* instance) { | 508 PepperPluginInstanceImpl* instance) { |
505 if (instance != render_view_->focused_pepper_plugin()) | 509 if (instance != render_view_->focused_pepper_plugin()) |
506 return; | 510 return; |
507 | 511 |
508 GetRenderWidget()->UpdateTextInputState( | 512 GetRenderWidget()->UpdateTextInputState( |
509 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); | 513 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); |
510 if (render_view_->renderer_accessibility()) | 514 if (renderer_accessibility()) |
511 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); | 515 renderer_accessibility()->FocusedNodeChanged(WebNode()); |
512 } | 516 } |
513 | 517 |
514 void RenderFrameImpl::PepperCaretPositionChanged( | 518 void RenderFrameImpl::PepperCaretPositionChanged( |
515 PepperPluginInstanceImpl* instance) { | 519 PepperPluginInstanceImpl* instance) { |
516 if (instance != render_view_->focused_pepper_plugin()) | 520 if (instance != render_view_->focused_pepper_plugin()) |
517 return; | 521 return; |
518 GetRenderWidget()->UpdateSelectionBounds(); | 522 GetRenderWidget()->UpdateSelectionBounds(); |
519 } | 523 } |
520 | 524 |
521 void RenderFrameImpl::PepperCancelComposition( | 525 void RenderFrameImpl::PepperCancelComposition( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 726 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
723 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 727 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
724 OnJavaScriptExecuteRequest) | 728 OnJavaScriptExecuteRequest) |
725 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 729 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
726 OnSetEditableSelectionOffsets) | 730 OnSetEditableSelectionOffsets) |
727 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 731 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
728 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 732 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
729 OnTextSurroundingSelectionRequest) | 733 OnTextSurroundingSelectionRequest) |
730 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, | 734 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, |
731 OnAddStyleSheetByURL) | 735 OnAddStyleSheetByURL) |
| 736 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 737 OnSetAccessibilityMode) |
732 #if defined(OS_MACOSX) | 738 #if defined(OS_MACOSX) |
733 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 739 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
734 #endif | 740 #endif |
735 IPC_END_MESSAGE_MAP() | 741 IPC_END_MESSAGE_MAP() |
736 | 742 |
737 return handled; | 743 return handled; |
738 } | 744 } |
739 | 745 |
740 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 746 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
741 MaybeHandleDebugURL(params.url); | 747 MaybeHandleDebugURL(params.url); |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 frame_->setCompositionFromExistingText(start, end, underlines); | 1188 frame_->setCompositionFromExistingText(start, end, underlines); |
1183 } | 1189 } |
1184 | 1190 |
1185 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1191 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
1186 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1192 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
1187 return; | 1193 return; |
1188 ImeEventGuard guard(GetRenderWidget()); | 1194 ImeEventGuard guard(GetRenderWidget()); |
1189 frame_->extendSelectionAndDelete(before, after); | 1195 frame_->extendSelectionAndDelete(before, after); |
1190 } | 1196 } |
1191 | 1197 |
| 1198 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
| 1199 if (accessibility_mode_ == new_mode) |
| 1200 return; |
| 1201 accessibility_mode_ = new_mode; |
| 1202 if (renderer_accessibility_) { |
| 1203 delete renderer_accessibility_; |
| 1204 renderer_accessibility_ = NULL; |
| 1205 } |
| 1206 if (accessibility_mode_ == AccessibilityModeOff) |
| 1207 return; |
| 1208 |
| 1209 if (accessibility_mode_ & AccessibilityModeFlagFullTree) |
| 1210 renderer_accessibility_ = new RendererAccessibilityComplete(this); |
| 1211 #if !defined(OS_ANDROID) |
| 1212 else |
| 1213 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); |
| 1214 #endif |
| 1215 } |
| 1216 |
1192 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1217 void RenderFrameImpl::OnReload(bool ignore_cache) { |
1193 frame_->reload(ignore_cache); | 1218 frame_->reload(ignore_cache); |
1194 } | 1219 } |
1195 | 1220 |
1196 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { | 1221 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { |
1197 blink::WebSurroundingText surroundingText; | 1222 blink::WebSurroundingText surroundingText; |
1198 surroundingText.initialize(frame_->selectionRange(), max_length); | 1223 surroundingText.initialize(frame_->selectionRange(), max_length); |
1199 | 1224 |
1200 if (surroundingText.isNull()) { | 1225 if (surroundingText.isNull()) { |
1201 // |surroundingText| might not be correctly initialized, for example if | 1226 // |surroundingText| might not be correctly initialized, for example if |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3157 | 3182 |
3158 void RenderFrameImpl::didStopLoading() { | 3183 void RenderFrameImpl::didStopLoading() { |
3159 render_view_->FrameDidStopLoading(frame_); | 3184 render_view_->FrameDidStopLoading(frame_); |
3160 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3185 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
3161 } | 3186 } |
3162 | 3187 |
3163 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3188 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
3164 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 3189 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
3165 } | 3190 } |
3166 | 3191 |
| 3192 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 3193 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 3194 if (renderer_accessibility_) |
| 3195 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 3196 } |
| 3197 |
| 3198 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 3199 if (renderer_accessibility_) |
| 3200 renderer_accessibility_->FocusedNodeChanged(node); |
| 3201 } |
| 3202 |
3167 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3203 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
3168 RenderFrame* render_frame, | 3204 RenderFrame* render_frame, |
3169 WebFrame* frame, | 3205 WebFrame* frame, |
3170 WebDataSource::ExtraData* extraData, | 3206 WebDataSource::ExtraData* extraData, |
3171 const WebURLRequest& request, | 3207 const WebURLRequest& request, |
3172 WebNavigationType type, | 3208 WebNavigationType type, |
3173 WebNavigationPolicy default_policy, | 3209 WebNavigationPolicy default_policy, |
3174 bool is_redirect) { | 3210 bool is_redirect) { |
3175 #ifdef OS_ANDROID | 3211 #ifdef OS_ANDROID |
3176 // The handlenavigation API is deprecated and will be removed once | 3212 // The handlenavigation API is deprecated and will be removed once |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3596 | 3632 |
3597 #if defined(ENABLE_BROWSER_CDMS) | 3633 #if defined(ENABLE_BROWSER_CDMS) |
3598 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3634 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3599 if (!cdm_manager_) | 3635 if (!cdm_manager_) |
3600 cdm_manager_ = new RendererCdmManager(this); | 3636 cdm_manager_ = new RendererCdmManager(this); |
3601 return cdm_manager_; | 3637 return cdm_manager_; |
3602 } | 3638 } |
3603 #endif // defined(ENABLE_BROWSER_CDMS) | 3639 #endif // defined(ENABLE_BROWSER_CDMS) |
3604 | 3640 |
3605 } // namespace content | 3641 } // namespace content |
OLD | NEW |