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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 routing_id_(routing_id), | 385 routing_id_(routing_id), |
384 is_swapped_out_(false), | 386 is_swapped_out_(false), |
385 is_detaching_(false), | 387 is_detaching_(false), |
386 cookie_jar_(this), | 388 cookie_jar_(this), |
387 selection_text_offset_(0), | 389 selection_text_offset_(0), |
388 selection_range_(gfx::Range::InvalidRange()), | 390 selection_range_(gfx::Range::InvalidRange()), |
389 handling_select_range_(false), | 391 handling_select_range_(false), |
390 notification_provider_(NULL), | 392 notification_provider_(NULL), |
391 media_stream_client_(NULL), | 393 media_stream_client_(NULL), |
392 web_user_media_client_(NULL), | 394 web_user_media_client_(NULL), |
| 395 accessibility_mode_(AccessibilityModeOff), |
| 396 renderer_accessibility_(NULL), |
393 weak_factory_(this) { | 397 weak_factory_(this) { |
394 RenderThread::Get()->AddRoute(routing_id_, this); | 398 RenderThread::Get()->AddRoute(routing_id_, this); |
395 | 399 |
396 #if defined(OS_ANDROID) | 400 #if defined(OS_ANDROID) |
397 new JavaBridgeDispatcher(this); | 401 new JavaBridgeDispatcher(this); |
398 #endif | 402 #endif |
399 | 403 |
400 #if defined(ENABLE_NOTIFICATIONS) | 404 #if defined(ENABLE_NOTIFICATIONS) |
401 notification_provider_ = new NotificationProvider(this); | 405 notification_provider_ = new NotificationProvider(this); |
402 #endif | 406 #endif |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 PepperPluginInstanceImpl* instance) { | 462 PepperPluginInstanceImpl* instance) { |
459 render_view_->set_pepper_last_mouse_event_target(instance); | 463 render_view_->set_pepper_last_mouse_event_target(instance); |
460 } | 464 } |
461 | 465 |
462 void RenderFrameImpl::PepperTextInputTypeChanged( | 466 void RenderFrameImpl::PepperTextInputTypeChanged( |
463 PepperPluginInstanceImpl* instance) { | 467 PepperPluginInstanceImpl* instance) { |
464 if (instance != render_view_->focused_pepper_plugin()) | 468 if (instance != render_view_->focused_pepper_plugin()) |
465 return; | 469 return; |
466 | 470 |
467 GetRenderWidget()->UpdateTextInputType(); | 471 GetRenderWidget()->UpdateTextInputType(); |
468 if (render_view_->renderer_accessibility()) | 472 if (renderer_accessibility()) |
469 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); | 473 renderer_accessibility()->FocusedNodeChanged(WebNode()); |
470 } | 474 } |
471 | 475 |
472 void RenderFrameImpl::PepperCaretPositionChanged( | 476 void RenderFrameImpl::PepperCaretPositionChanged( |
473 PepperPluginInstanceImpl* instance) { | 477 PepperPluginInstanceImpl* instance) { |
474 if (instance != render_view_->focused_pepper_plugin()) | 478 if (instance != render_view_->focused_pepper_plugin()) |
475 return; | 479 return; |
476 GetRenderWidget()->UpdateSelectionBounds(); | 480 GetRenderWidget()->UpdateSelectionBounds(); |
477 } | 481 } |
478 | 482 |
479 void RenderFrameImpl::PepperCancelComposition( | 483 void RenderFrameImpl::PepperCancelComposition( |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 675 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
672 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 676 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
673 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 677 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
674 OnJavaScriptExecuteRequest) | 678 OnJavaScriptExecuteRequest) |
675 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 679 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
676 OnSetEditableSelectionOffsets) | 680 OnSetEditableSelectionOffsets) |
677 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, | 681 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, |
678 OnSetCompositionFromExistingText) | 682 OnSetCompositionFromExistingText) |
679 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, | 683 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, |
680 OnExtendSelectionAndDelete) | 684 OnExtendSelectionAndDelete) |
| 685 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 686 OnSetAccessibilityMode) |
681 #if defined(OS_MACOSX) | 687 #if defined(OS_MACOSX) |
682 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 688 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
683 #endif | 689 #endif |
684 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 690 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
685 IPC_END_MESSAGE_MAP_EX() | 691 IPC_END_MESSAGE_MAP_EX() |
686 | 692 |
687 if (!msg_is_ok) { | 693 if (!msg_is_ok) { |
688 // The message had a handler, but its deserialization failed. | 694 // The message had a handler, but its deserialization failed. |
689 // Kill the renderer to avoid potential spoofing attacks. | 695 // Kill the renderer to avoid potential spoofing attacks. |
690 int id = msg.type(); | 696 int id = msg.type(); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 frame_->setCompositionFromExistingText(start, end, underlines); | 1156 frame_->setCompositionFromExistingText(start, end, underlines); |
1151 } | 1157 } |
1152 | 1158 |
1153 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1159 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
1154 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1160 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
1155 return; | 1161 return; |
1156 ImeEventGuard guard(GetRenderWidget()); | 1162 ImeEventGuard guard(GetRenderWidget()); |
1157 frame_->extendSelectionAndDelete(before, after); | 1163 frame_->extendSelectionAndDelete(before, after); |
1158 } | 1164 } |
1159 | 1165 |
| 1166 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
| 1167 if (accessibility_mode_ == new_mode) |
| 1168 return; |
| 1169 accessibility_mode_ = new_mode; |
| 1170 if (renderer_accessibility_) { |
| 1171 delete renderer_accessibility_; |
| 1172 renderer_accessibility_ = NULL; |
| 1173 } |
| 1174 if (accessibility_mode_ == AccessibilityModeOff) |
| 1175 return; |
| 1176 |
| 1177 if (accessibility_mode_ & AccessibilityModeFlagFullTree) |
| 1178 renderer_accessibility_ = new RendererAccessibilityComplete(this); |
| 1179 #if !defined(OS_ANDROID) |
| 1180 else |
| 1181 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); |
| 1182 #endif |
| 1183 } |
1160 | 1184 |
1161 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1185 void RenderFrameImpl::OnReload(bool ignore_cache) { |
1162 frame_->reload(ignore_cache); | 1186 frame_->reload(ignore_cache); |
1163 } | 1187 } |
1164 | 1188 |
1165 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( | 1189 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( |
1166 const base::string16& selection_text, | 1190 const base::string16& selection_text, |
1167 size_t selection_text_offset, | 1191 size_t selection_text_offset, |
1168 const gfx::Range& selection_range, | 1192 const gfx::Range& selection_range, |
1169 const ContextMenuParams& params) { | 1193 const ContextMenuParams& params) { |
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 // finished parsing the head, but webkit doesn't support that yet. | 3073 // finished parsing the head, but webkit doesn't support that yet. |
3050 // The feed discovery code would also benefit from access to the head. | 3074 // The feed discovery code would also benefit from access to the head. |
3051 if (!render_view_->is_loading()) | 3075 if (!render_view_->is_loading()) |
3052 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3076 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
3053 } | 3077 } |
3054 | 3078 |
3055 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3079 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
3056 render_view_->FrameDidChangeLoadProgress(frame_, load_progress); | 3080 render_view_->FrameDidChangeLoadProgress(frame_, load_progress); |
3057 } | 3081 } |
3058 | 3082 |
| 3083 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 3084 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 3085 if (renderer_accessibility_) |
| 3086 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 3087 } |
| 3088 |
| 3089 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 3090 if (renderer_accessibility_) |
| 3091 renderer_accessibility_->FocusedNodeChanged(node); |
| 3092 } |
| 3093 |
3059 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3094 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
3060 RenderFrame* render_frame, | 3095 RenderFrame* render_frame, |
3061 WebFrame* frame, | 3096 WebFrame* frame, |
3062 WebDataSource::ExtraData* extraData, | 3097 WebDataSource::ExtraData* extraData, |
3063 const WebURLRequest& request, | 3098 const WebURLRequest& request, |
3064 WebNavigationType type, | 3099 WebNavigationType type, |
3065 WebNavigationPolicy default_policy, | 3100 WebNavigationPolicy default_policy, |
3066 bool is_redirect) { | 3101 bool is_redirect) { |
3067 #ifdef OS_ANDROID | 3102 #ifdef OS_ANDROID |
3068 // The handlenavigation API is deprecated and will be removed once | 3103 // The handlenavigation API is deprecated and will be removed once |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3470 weak_factory_.GetWeakPtr(), | 3505 weak_factory_.GetWeakPtr(), |
3471 render_view_->media_player_manager_, | 3506 render_view_->media_player_manager_, |
3472 stream_texture_factory, | 3507 stream_texture_factory, |
3473 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 3508 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
3474 new RenderMediaLog()); | 3509 new RenderMediaLog()); |
3475 } | 3510 } |
3476 | 3511 |
3477 #endif | 3512 #endif |
3478 | 3513 |
3479 } // namespace content | 3514 } // namespace content |
OLD | NEW |