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 27 matching lines...) Expand all Loading... |
38 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
39 #include "content/public/common/context_menu_params.h" | 39 #include "content/public/common/context_menu_params.h" |
40 #include "content/public/common/url_constants.h" | 40 #include "content/public/common/url_constants.h" |
41 #include "content/public/common/url_utils.h" | 41 #include "content/public/common/url_utils.h" |
42 #include "content/public/renderer/content_renderer_client.h" | 42 #include "content/public/renderer/content_renderer_client.h" |
43 #include "content/public/renderer/context_menu_client.h" | 43 #include "content/public/renderer/context_menu_client.h" |
44 #include "content/public/renderer/document_state.h" | 44 #include "content/public/renderer/document_state.h" |
45 #include "content/public/renderer/navigation_state.h" | 45 #include "content/public/renderer/navigation_state.h" |
46 #include "content/public/renderer/render_frame_observer.h" | 46 #include "content/public/renderer/render_frame_observer.h" |
47 #include "content/renderer/accessibility/renderer_accessibility.h" | 47 #include "content/renderer/accessibility/renderer_accessibility.h" |
| 48 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
| 49 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" |
48 #include "content/renderer/browser_plugin/browser_plugin.h" | 50 #include "content/renderer/browser_plugin/browser_plugin.h" |
49 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 51 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
50 #include "content/renderer/child_frame_compositing_helper.h" | 52 #include "content/renderer/child_frame_compositing_helper.h" |
51 #include "content/renderer/context_menu_params_builder.h" | 53 #include "content/renderer/context_menu_params_builder.h" |
52 #include "content/renderer/devtools/devtools_agent.h" | 54 #include "content/renderer/devtools/devtools_agent.h" |
53 #include "content/renderer/dom_automation_controller.h" | 55 #include "content/renderer/dom_automation_controller.h" |
54 #include "content/renderer/history_controller.h" | 56 #include "content/renderer/history_controller.h" |
55 #include "content/renderer/history_serialization.h" | 57 #include "content/renderer/history_serialization.h" |
56 #include "content/renderer/image_loading_helper.h" | 58 #include "content/renderer/image_loading_helper.h" |
57 #include "content/renderer/ime_event_guard.h" | 59 #include "content/renderer/ime_event_guard.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 is_detaching_(false), | 404 is_detaching_(false), |
403 cookie_jar_(this), | 405 cookie_jar_(this), |
404 selection_text_offset_(0), | 406 selection_text_offset_(0), |
405 selection_range_(gfx::Range::InvalidRange()), | 407 selection_range_(gfx::Range::InvalidRange()), |
406 handling_select_range_(false), | 408 handling_select_range_(false), |
407 notification_provider_(NULL), | 409 notification_provider_(NULL), |
408 web_user_media_client_(NULL), | 410 web_user_media_client_(NULL), |
409 #if defined(OS_ANDROID) | 411 #if defined(OS_ANDROID) |
410 media_player_manager_(NULL), | 412 media_player_manager_(NULL), |
411 #endif | 413 #endif |
| 414 accessibility_mode_(AccessibilityModeOff), |
| 415 renderer_accessibility_(NULL), |
412 weak_factory_(this) { | 416 weak_factory_(this) { |
413 RenderThread::Get()->AddRoute(routing_id_, this); | 417 RenderThread::Get()->AddRoute(routing_id_, this); |
414 | 418 |
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 #if defined(OS_ANDROID) | 423 #if defined(OS_ANDROID) |
420 new JavaBridgeDispatcher(this); | 424 new JavaBridgeDispatcher(this); |
421 #endif | 425 #endif |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 PepperPluginInstanceImpl* instance) { | 490 PepperPluginInstanceImpl* instance) { |
487 render_view_->set_pepper_last_mouse_event_target(instance); | 491 render_view_->set_pepper_last_mouse_event_target(instance); |
488 } | 492 } |
489 | 493 |
490 void RenderFrameImpl::PepperTextInputTypeChanged( | 494 void RenderFrameImpl::PepperTextInputTypeChanged( |
491 PepperPluginInstanceImpl* instance) { | 495 PepperPluginInstanceImpl* instance) { |
492 if (instance != render_view_->focused_pepper_plugin()) | 496 if (instance != render_view_->focused_pepper_plugin()) |
493 return; | 497 return; |
494 | 498 |
495 GetRenderWidget()->UpdateTextInputType(); | 499 GetRenderWidget()->UpdateTextInputType(); |
496 if (render_view_->renderer_accessibility()) | 500 if (renderer_accessibility()) |
497 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); | 501 renderer_accessibility()->FocusedNodeChanged(WebNode()); |
498 } | 502 } |
499 | 503 |
500 void RenderFrameImpl::PepperCaretPositionChanged( | 504 void RenderFrameImpl::PepperCaretPositionChanged( |
501 PepperPluginInstanceImpl* instance) { | 505 PepperPluginInstanceImpl* instance) { |
502 if (instance != render_view_->focused_pepper_plugin()) | 506 if (instance != render_view_->focused_pepper_plugin()) |
503 return; | 507 return; |
504 GetRenderWidget()->UpdateSelectionBounds(); | 508 GetRenderWidget()->UpdateSelectionBounds(); |
505 } | 509 } |
506 | 510 |
507 void RenderFrameImpl::PepperCancelComposition( | 511 void RenderFrameImpl::PepperCancelComposition( |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 704 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
701 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 705 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
702 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 706 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
703 OnJavaScriptExecuteRequest) | 707 OnJavaScriptExecuteRequest) |
704 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 708 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
705 OnSetEditableSelectionOffsets) | 709 OnSetEditableSelectionOffsets) |
706 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, | 710 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, |
707 OnSetCompositionFromExistingText) | 711 OnSetCompositionFromExistingText) |
708 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, | 712 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, |
709 OnExtendSelectionAndDelete) | 713 OnExtendSelectionAndDelete) |
| 714 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 715 OnSetAccessibilityMode) |
710 #if defined(OS_MACOSX) | 716 #if defined(OS_MACOSX) |
711 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 717 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
712 #endif | 718 #endif |
713 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 719 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
714 IPC_END_MESSAGE_MAP() | 720 IPC_END_MESSAGE_MAP() |
715 | 721 |
716 return handled; | 722 return handled; |
717 } | 723 } |
718 | 724 |
719 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 725 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
(...skipping 462 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 } |
1192 | 1216 |
1193 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1217 void RenderFrameImpl::OnReload(bool ignore_cache) { |
1194 frame_->reload(ignore_cache); | 1218 frame_->reload(ignore_cache); |
1195 } | 1219 } |
1196 | 1220 |
1197 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( | 1221 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( |
1198 const base::string16& selection_text, | 1222 const base::string16& selection_text, |
1199 size_t selection_text_offset, | 1223 size_t selection_text_offset, |
1200 const gfx::Range& selection_range, | 1224 const gfx::Range& selection_range, |
1201 const ContextMenuParams& params) { | 1225 const ContextMenuParams& params) { |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3070 | 3094 |
3071 void RenderFrameImpl::didStopLoading() { | 3095 void RenderFrameImpl::didStopLoading() { |
3072 render_view_->FrameDidStopLoading(frame_); | 3096 render_view_->FrameDidStopLoading(frame_); |
3073 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3097 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
3074 } | 3098 } |
3075 | 3099 |
3076 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3100 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
3077 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 3101 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
3078 } | 3102 } |
3079 | 3103 |
| 3104 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 3105 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 3106 if (renderer_accessibility_) |
| 3107 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 3108 } |
| 3109 |
| 3110 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 3111 if (renderer_accessibility_) |
| 3112 renderer_accessibility_->FocusedNodeChanged(node); |
| 3113 } |
| 3114 |
3080 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3115 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
3081 RenderFrame* render_frame, | 3116 RenderFrame* render_frame, |
3082 WebFrame* frame, | 3117 WebFrame* frame, |
3083 WebDataSource::ExtraData* extraData, | 3118 WebDataSource::ExtraData* extraData, |
3084 const WebURLRequest& request, | 3119 const WebURLRequest& request, |
3085 WebNavigationType type, | 3120 WebNavigationType type, |
3086 WebNavigationPolicy default_policy, | 3121 WebNavigationPolicy default_policy, |
3087 bool is_redirect) { | 3122 bool is_redirect) { |
3088 #ifdef OS_ANDROID | 3123 #ifdef OS_ANDROID |
3089 // The handlenavigation API is deprecated and will be removed once | 3124 // The handlenavigation API is deprecated and will be removed once |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 #if defined(VIDEO_HOLE) | 3542 #if defined(VIDEO_HOLE) |
3508 render_view_->RegisterVideoHoleFrame(this); | 3543 render_view_->RegisterVideoHoleFrame(this); |
3509 #endif // defined(VIDEO_HOLE) | 3544 #endif // defined(VIDEO_HOLE) |
3510 } | 3545 } |
3511 return media_player_manager_; | 3546 return media_player_manager_; |
3512 } | 3547 } |
3513 | 3548 |
3514 #endif // defined(OS_ANDROID) | 3549 #endif // defined(OS_ANDROID) |
3515 | 3550 |
3516 } // namespace content | 3551 } // namespace content |
OLD | NEW |