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" | |
52 #include "content/renderer/browser_plugin/browser_plugin.h" | 50 #include "content/renderer/browser_plugin/browser_plugin.h" |
53 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 51 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
54 #include "content/renderer/child_frame_compositing_helper.h" | 52 #include "content/renderer/child_frame_compositing_helper.h" |
55 #include "content/renderer/context_menu_params_builder.h" | 53 #include "content/renderer/context_menu_params_builder.h" |
56 #include "content/renderer/devtools/devtools_agent.h" | 54 #include "content/renderer/devtools/devtools_agent.h" |
57 #include "content/renderer/dom_automation_controller.h" | 55 #include "content/renderer/dom_automation_controller.h" |
58 #include "content/renderer/geolocation_dispatcher.h" | 56 #include "content/renderer/geolocation_dispatcher.h" |
59 #include "content/renderer/history_controller.h" | 57 #include "content/renderer/history_controller.h" |
60 #include "content/renderer/history_serialization.h" | 58 #include "content/renderer/history_serialization.h" |
61 #include "content/renderer/image_loading_helper.h" | 59 #include "content/renderer/image_loading_helper.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 #endif | 404 #endif |
407 #if defined(ENABLE_BROWSER_CDMS) | 405 #if defined(ENABLE_BROWSER_CDMS) |
408 cdm_manager_(NULL), | 406 cdm_manager_(NULL), |
409 #endif | 407 #endif |
410 #if defined(VIDEO_HOLE) | 408 #if defined(VIDEO_HOLE) |
411 contains_media_player_(false), | 409 contains_media_player_(false), |
412 #endif | 410 #endif |
413 geolocation_dispatcher_(NULL), | 411 geolocation_dispatcher_(NULL), |
414 push_messaging_dispatcher_(NULL), | 412 push_messaging_dispatcher_(NULL), |
415 screen_orientation_dispatcher_(NULL), | 413 screen_orientation_dispatcher_(NULL), |
416 accessibility_mode_(AccessibilityModeOff), | |
417 renderer_accessibility_(NULL), | |
418 weak_factory_(this) { | 414 weak_factory_(this) { |
419 std::pair<RoutingIDFrameMap::iterator, bool> result = | 415 std::pair<RoutingIDFrameMap::iterator, bool> result = |
420 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); | 416 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
421 CHECK(result.second) << "Inserting a duplicate item."; | 417 CHECK(result.second) << "Inserting a duplicate item."; |
422 | 418 |
423 RenderThread::Get()->AddRoute(routing_id_, this); | 419 RenderThread::Get()->AddRoute(routing_id_, this); |
424 | 420 |
425 render_view_->RegisterRenderFrame(this); | 421 render_view_->RegisterRenderFrame(this); |
426 | 422 |
427 #if defined(OS_ANDROID) | 423 #if defined(OS_ANDROID) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 render_view_->set_pepper_last_mouse_event_target(instance); | 494 render_view_->set_pepper_last_mouse_event_target(instance); |
499 } | 495 } |
500 | 496 |
501 void RenderFrameImpl::PepperTextInputTypeChanged( | 497 void RenderFrameImpl::PepperTextInputTypeChanged( |
502 PepperPluginInstanceImpl* instance) { | 498 PepperPluginInstanceImpl* instance) { |
503 if (instance != render_view_->focused_pepper_plugin()) | 499 if (instance != render_view_->focused_pepper_plugin()) |
504 return; | 500 return; |
505 | 501 |
506 GetRenderWidget()->UpdateTextInputState( | 502 GetRenderWidget()->UpdateTextInputState( |
507 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); | 503 RenderWidget::NO_SHOW_IME, RenderWidget::FROM_NON_IME); |
508 if (renderer_accessibility()) | 504 if (render_view_->renderer_accessibility()) |
509 renderer_accessibility()->FocusedNodeChanged(WebNode()); | 505 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); |
510 } | 506 } |
511 | 507 |
512 void RenderFrameImpl::PepperCaretPositionChanged( | 508 void RenderFrameImpl::PepperCaretPositionChanged( |
513 PepperPluginInstanceImpl* instance) { | 509 PepperPluginInstanceImpl* instance) { |
514 if (instance != render_view_->focused_pepper_plugin()) | 510 if (instance != render_view_->focused_pepper_plugin()) |
515 return; | 511 return; |
516 GetRenderWidget()->UpdateSelectionBounds(); | 512 GetRenderWidget()->UpdateSelectionBounds(); |
517 } | 513 } |
518 | 514 |
519 void RenderFrameImpl::PepperCancelComposition( | 515 void RenderFrameImpl::PepperCancelComposition( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 716 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
721 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 717 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
722 OnJavaScriptExecuteRequest) | 718 OnJavaScriptExecuteRequest) |
723 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 719 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
724 OnSetEditableSelectionOffsets) | 720 OnSetEditableSelectionOffsets) |
725 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 721 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
726 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 722 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
727 OnTextSurroundingSelectionRequest) | 723 OnTextSurroundingSelectionRequest) |
728 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, | 724 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, |
729 OnAddStyleSheetByURL) | 725 OnAddStyleSheetByURL) |
730 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | |
731 OnSetAccessibilityMode) | |
732 #if defined(OS_MACOSX) | 726 #if defined(OS_MACOSX) |
733 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 727 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
734 #endif | 728 #endif |
735 IPC_END_MESSAGE_MAP() | 729 IPC_END_MESSAGE_MAP() |
736 | 730 |
737 return handled; | 731 return handled; |
738 } | 732 } |
739 | 733 |
740 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 734 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
741 MaybeHandleDebugURL(params.url); | 735 MaybeHandleDebugURL(params.url); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 frame_->setCompositionFromExistingText(start, end, underlines); | 1171 frame_->setCompositionFromExistingText(start, end, underlines); |
1178 } | 1172 } |
1179 | 1173 |
1180 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1174 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
1181 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1175 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
1182 return; | 1176 return; |
1183 ImeEventGuard guard(GetRenderWidget()); | 1177 ImeEventGuard guard(GetRenderWidget()); |
1184 frame_->extendSelectionAndDelete(before, after); | 1178 frame_->extendSelectionAndDelete(before, after); |
1185 } | 1179 } |
1186 | 1180 |
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 | |
1206 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1181 void RenderFrameImpl::OnReload(bool ignore_cache) { |
1207 frame_->reload(ignore_cache); | 1182 frame_->reload(ignore_cache); |
1208 } | 1183 } |
1209 | 1184 |
1210 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { | 1185 void RenderFrameImpl::OnTextSurroundingSelectionRequest(size_t max_length) { |
1211 blink::WebSurroundingText surroundingText; | 1186 blink::WebSurroundingText surroundingText; |
1212 surroundingText.initialize(frame_->selectionRange(), max_length); | 1187 surroundingText.initialize(frame_->selectionRange(), max_length); |
1213 | 1188 |
1214 if (surroundingText.isNull()) { | 1189 if (surroundingText.isNull()) { |
1215 // |surroundingText| might not be correctly initialized, for example if | 1190 // |surroundingText| might not be correctly initialized, for example if |
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3153 | 3128 |
3154 void RenderFrameImpl::didStopLoading() { | 3129 void RenderFrameImpl::didStopLoading() { |
3155 render_view_->FrameDidStopLoading(frame_); | 3130 render_view_->FrameDidStopLoading(frame_); |
3156 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3131 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
3157 } | 3132 } |
3158 | 3133 |
3159 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3134 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
3160 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 3135 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
3161 } | 3136 } |
3162 | 3137 |
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 | |
3174 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3138 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
3175 RenderFrame* render_frame, | 3139 RenderFrame* render_frame, |
3176 WebFrame* frame, | 3140 WebFrame* frame, |
3177 WebDataSource::ExtraData* extraData, | 3141 WebDataSource::ExtraData* extraData, |
3178 const WebURLRequest& request, | 3142 const WebURLRequest& request, |
3179 WebNavigationType type, | 3143 WebNavigationType type, |
3180 WebNavigationPolicy default_policy, | 3144 WebNavigationPolicy default_policy, |
3181 bool is_redirect) { | 3145 bool is_redirect) { |
3182 #ifdef OS_ANDROID | 3146 #ifdef OS_ANDROID |
3183 // The handlenavigation API is deprecated and will be removed once | 3147 // The handlenavigation API is deprecated and will be removed once |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 | 3567 |
3604 #if defined(ENABLE_BROWSER_CDMS) | 3568 #if defined(ENABLE_BROWSER_CDMS) |
3605 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3569 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3606 if (!cdm_manager_) | 3570 if (!cdm_manager_) |
3607 cdm_manager_ = new RendererCdmManager(this); | 3571 cdm_manager_ = new RendererCdmManager(this); |
3608 return cdm_manager_; | 3572 return cdm_manager_; |
3609 } | 3573 } |
3610 #endif // defined(ENABLE_BROWSER_CDMS) | 3574 #endif // defined(ENABLE_BROWSER_CDMS) |
3611 | 3575 |
3612 } // namespace content | 3576 } // namespace content |
OLD | NEW |