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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 routing_id_(routing_id), | 359 routing_id_(routing_id), |
358 is_swapped_out_(false), | 360 is_swapped_out_(false), |
359 is_detaching_(false), | 361 is_detaching_(false), |
360 cookie_jar_(this), | 362 cookie_jar_(this), |
361 selection_text_offset_(0), | 363 selection_text_offset_(0), |
362 selection_range_(gfx::Range::InvalidRange()), | 364 selection_range_(gfx::Range::InvalidRange()), |
363 handling_select_range_(false), | 365 handling_select_range_(false), |
364 notification_provider_(NULL), | 366 notification_provider_(NULL), |
365 media_stream_client_(NULL), | 367 media_stream_client_(NULL), |
366 web_user_media_client_(NULL), | 368 web_user_media_client_(NULL), |
| 369 accessibility_mode_(AccessibilityModeOff), |
| 370 renderer_accessibility_(NULL), |
367 weak_factory_(this) { | 371 weak_factory_(this) { |
368 RenderThread::Get()->AddRoute(routing_id_, this); | 372 RenderThread::Get()->AddRoute(routing_id_, this); |
369 | 373 |
370 #if defined(OS_ANDROID) | 374 #if defined(OS_ANDROID) |
371 new JavaBridgeDispatcher(this); | 375 new JavaBridgeDispatcher(this); |
372 #endif | 376 #endif |
373 | 377 |
374 #if defined(ENABLE_NOTIFICATIONS) | 378 #if defined(ENABLE_NOTIFICATIONS) |
375 notification_provider_ = new NotificationProvider(this); | 379 notification_provider_ = new NotificationProvider(this); |
376 #endif | 380 #endif |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 PepperPluginInstanceImpl* instance) { | 436 PepperPluginInstanceImpl* instance) { |
433 render_view_->set_pepper_last_mouse_event_target(instance); | 437 render_view_->set_pepper_last_mouse_event_target(instance); |
434 } | 438 } |
435 | 439 |
436 void RenderFrameImpl::PepperTextInputTypeChanged( | 440 void RenderFrameImpl::PepperTextInputTypeChanged( |
437 PepperPluginInstanceImpl* instance) { | 441 PepperPluginInstanceImpl* instance) { |
438 if (instance != render_view_->focused_pepper_plugin()) | 442 if (instance != render_view_->focused_pepper_plugin()) |
439 return; | 443 return; |
440 | 444 |
441 GetRenderWidget()->UpdateTextInputType(); | 445 GetRenderWidget()->UpdateTextInputType(); |
442 if (render_view_->renderer_accessibility()) | 446 if (renderer_accessibility()) |
443 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); | 447 renderer_accessibility()->FocusedNodeChanged(WebNode()); |
444 } | 448 } |
445 | 449 |
446 void RenderFrameImpl::PepperCaretPositionChanged( | 450 void RenderFrameImpl::PepperCaretPositionChanged( |
447 PepperPluginInstanceImpl* instance) { | 451 PepperPluginInstanceImpl* instance) { |
448 if (instance != render_view_->focused_pepper_plugin()) | 452 if (instance != render_view_->focused_pepper_plugin()) |
449 return; | 453 return; |
450 GetRenderWidget()->UpdateSelectionBounds(); | 454 GetRenderWidget()->UpdateSelectionBounds(); |
451 } | 455 } |
452 | 456 |
453 void RenderFrameImpl::PepperCancelComposition( | 457 void RenderFrameImpl::PepperCancelComposition( |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 649 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
646 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 650 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
647 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 651 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
648 OnJavaScriptExecuteRequest) | 652 OnJavaScriptExecuteRequest) |
649 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 653 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
650 OnSetEditableSelectionOffsets) | 654 OnSetEditableSelectionOffsets) |
651 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, | 655 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, |
652 OnSetCompositionFromExistingText) | 656 OnSetCompositionFromExistingText) |
653 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, | 657 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, |
654 OnExtendSelectionAndDelete) | 658 OnExtendSelectionAndDelete) |
| 659 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 660 OnSetAccessibilityMode) |
655 #if defined(OS_MACOSX) | 661 #if defined(OS_MACOSX) |
656 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 662 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
657 #endif | 663 #endif |
658 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 664 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
659 IPC_END_MESSAGE_MAP_EX() | 665 IPC_END_MESSAGE_MAP_EX() |
660 | 666 |
661 if (!msg_is_ok) { | 667 if (!msg_is_ok) { |
662 // The message had a handler, but its deserialization failed. | 668 // The message had a handler, but its deserialization failed. |
663 // Kill the renderer to avoid potential spoofing attacks. | 669 // Kill the renderer to avoid potential spoofing attacks. |
664 int id = msg.type(); | 670 int id = msg.type(); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 frame_->setCompositionFromExistingText(start, end, underlines); | 1130 frame_->setCompositionFromExistingText(start, end, underlines); |
1125 } | 1131 } |
1126 | 1132 |
1127 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1133 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
1128 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1134 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
1129 return; | 1135 return; |
1130 ImeEventGuard guard(GetRenderWidget()); | 1136 ImeEventGuard guard(GetRenderWidget()); |
1131 frame_->extendSelectionAndDelete(before, after); | 1137 frame_->extendSelectionAndDelete(before, after); |
1132 } | 1138 } |
1133 | 1139 |
| 1140 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
| 1141 if (accessibility_mode_ == new_mode) |
| 1142 return; |
| 1143 accessibility_mode_ = new_mode; |
| 1144 if (renderer_accessibility_) { |
| 1145 delete renderer_accessibility_; |
| 1146 renderer_accessibility_ = NULL; |
| 1147 } |
| 1148 if (accessibility_mode_ == AccessibilityModeOff) |
| 1149 return; |
| 1150 |
| 1151 if (accessibility_mode_ & AccessibilityModeFlagFullTree) |
| 1152 renderer_accessibility_ = new RendererAccessibilityComplete(this); |
| 1153 #if !defined(OS_ANDROID) |
| 1154 else |
| 1155 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); |
| 1156 #endif |
| 1157 } |
1134 | 1158 |
1135 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1159 void RenderFrameImpl::OnReload(bool ignore_cache) { |
1136 frame_->reload(ignore_cache); | 1160 frame_->reload(ignore_cache); |
1137 } | 1161 } |
1138 | 1162 |
1139 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( | 1163 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( |
1140 const base::string16& selection_text, | 1164 const base::string16& selection_text, |
1141 size_t selection_text_offset, | 1165 size_t selection_text_offset, |
1142 const gfx::Range& selection_range, | 1166 const gfx::Range& selection_range, |
1143 const ContextMenuParams& params) { | 1167 const ContextMenuParams& params) { |
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 // finished parsing the head, but webkit doesn't support that yet. | 3039 // finished parsing the head, but webkit doesn't support that yet. |
3016 // The feed discovery code would also benefit from access to the head. | 3040 // The feed discovery code would also benefit from access to the head. |
3017 if (!render_view_->is_loading()) | 3041 if (!render_view_->is_loading()) |
3018 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3042 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
3019 } | 3043 } |
3020 | 3044 |
3021 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3045 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
3022 render_view_->FrameDidChangeLoadProgress(frame_, load_progress); | 3046 render_view_->FrameDidChangeLoadProgress(frame_, load_progress); |
3023 } | 3047 } |
3024 | 3048 |
| 3049 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 3050 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 3051 if (renderer_accessibility_) |
| 3052 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 3053 } |
| 3054 |
3025 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3055 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
3026 RenderFrame* render_frame, | 3056 RenderFrame* render_frame, |
3027 WebFrame* frame, | 3057 WebFrame* frame, |
3028 WebDataSource::ExtraData* extraData, | 3058 WebDataSource::ExtraData* extraData, |
3029 const WebURLRequest& request, | 3059 const WebURLRequest& request, |
3030 WebNavigationType type, | 3060 WebNavigationType type, |
3031 WebNavigationPolicy default_policy, | 3061 WebNavigationPolicy default_policy, |
3032 bool is_redirect) { | 3062 bool is_redirect) { |
3033 #ifdef OS_ANDROID | 3063 #ifdef OS_ANDROID |
3034 // The handlenavigation API is deprecated and will be removed once | 3064 // The handlenavigation API is deprecated and will be removed once |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3429 weak_factory_.GetWeakPtr(), | 3459 weak_factory_.GetWeakPtr(), |
3430 render_view_->media_player_manager_, | 3460 render_view_->media_player_manager_, |
3431 stream_texture_factory, | 3461 stream_texture_factory, |
3432 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 3462 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
3433 new RenderMediaLog()); | 3463 new RenderMediaLog()); |
3434 } | 3464 } |
3435 | 3465 |
3436 #endif | 3466 #endif |
3437 | 3467 |
3438 } // namespace content | 3468 } // namespace content |
OLD | NEW |