| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 is_swapped_out_(false), | 399 is_swapped_out_(false), |
| 398 render_frame_proxy_(NULL), | 400 render_frame_proxy_(NULL), |
| 399 is_detaching_(false), | 401 is_detaching_(false), |
| 400 cookie_jar_(this), | 402 cookie_jar_(this), |
| 401 selection_text_offset_(0), | 403 selection_text_offset_(0), |
| 402 selection_range_(gfx::Range::InvalidRange()), | 404 selection_range_(gfx::Range::InvalidRange()), |
| 403 handling_select_range_(false), | 405 handling_select_range_(false), |
| 404 notification_provider_(NULL), | 406 notification_provider_(NULL), |
| 405 media_stream_client_(NULL), | 407 media_stream_client_(NULL), |
| 406 web_user_media_client_(NULL), | 408 web_user_media_client_(NULL), |
| 409 accessibility_mode_(AccessibilityModeOff), |
| 410 renderer_accessibility_(NULL), |
| 407 weak_factory_(this) { | 411 weak_factory_(this) { |
| 408 RenderThread::Get()->AddRoute(routing_id_, this); | 412 RenderThread::Get()->AddRoute(routing_id_, this); |
| 409 | 413 |
| 410 std::pair<RoutingIDFrameMap::iterator, bool> result = | 414 std::pair<RoutingIDFrameMap::iterator, bool> result = |
| 411 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); | 415 g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
| 412 CHECK(result.second) << "Inserting a duplicate item."; | 416 CHECK(result.second) << "Inserting a duplicate item."; |
| 413 | 417 |
| 414 #if defined(OS_ANDROID) | 418 #if defined(OS_ANDROID) |
| 415 new JavaBridgeDispatcher(this); | 419 new JavaBridgeDispatcher(this); |
| 416 #endif | 420 #endif |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 PepperPluginInstanceImpl* instance) { | 481 PepperPluginInstanceImpl* instance) { |
| 478 render_view_->set_pepper_last_mouse_event_target(instance); | 482 render_view_->set_pepper_last_mouse_event_target(instance); |
| 479 } | 483 } |
| 480 | 484 |
| 481 void RenderFrameImpl::PepperTextInputTypeChanged( | 485 void RenderFrameImpl::PepperTextInputTypeChanged( |
| 482 PepperPluginInstanceImpl* instance) { | 486 PepperPluginInstanceImpl* instance) { |
| 483 if (instance != render_view_->focused_pepper_plugin()) | 487 if (instance != render_view_->focused_pepper_plugin()) |
| 484 return; | 488 return; |
| 485 | 489 |
| 486 GetRenderWidget()->UpdateTextInputType(); | 490 GetRenderWidget()->UpdateTextInputType(); |
| 487 if (render_view_->renderer_accessibility()) | 491 if (renderer_accessibility()) |
| 488 render_view_->renderer_accessibility()->FocusedNodeChanged(WebNode()); | 492 renderer_accessibility()->FocusedNodeChanged(WebNode()); |
| 489 } | 493 } |
| 490 | 494 |
| 491 void RenderFrameImpl::PepperCaretPositionChanged( | 495 void RenderFrameImpl::PepperCaretPositionChanged( |
| 492 PepperPluginInstanceImpl* instance) { | 496 PepperPluginInstanceImpl* instance) { |
| 493 if (instance != render_view_->focused_pepper_plugin()) | 497 if (instance != render_view_->focused_pepper_plugin()) |
| 494 return; | 498 return; |
| 495 GetRenderWidget()->UpdateSelectionBounds(); | 499 GetRenderWidget()->UpdateSelectionBounds(); |
| 496 } | 500 } |
| 497 | 501 |
| 498 void RenderFrameImpl::PepperCancelComposition( | 502 void RenderFrameImpl::PepperCancelComposition( |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) | 702 IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) |
| 699 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) | 703 IPC_MESSAGE_HANDLER(FrameMsg_CSSInsertRequest, OnCSSInsertRequest) |
| 700 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, | 704 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, |
| 701 OnJavaScriptExecuteRequest) | 705 OnJavaScriptExecuteRequest) |
| 702 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, | 706 IPC_MESSAGE_HANDLER(FrameMsg_SetEditableSelectionOffsets, |
| 703 OnSetEditableSelectionOffsets) | 707 OnSetEditableSelectionOffsets) |
| 704 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, | 708 IPC_MESSAGE_HANDLER(FrameMsg_SetCompositionFromExistingText, |
| 705 OnSetCompositionFromExistingText) | 709 OnSetCompositionFromExistingText) |
| 706 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, | 710 IPC_MESSAGE_HANDLER(FrameMsg_ExtendSelectionAndDelete, |
| 707 OnExtendSelectionAndDelete) | 711 OnExtendSelectionAndDelete) |
| 712 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 713 OnSetAccessibilityMode) |
| 708 #if defined(OS_MACOSX) | 714 #if defined(OS_MACOSX) |
| 709 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 715 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
| 710 #endif | 716 #endif |
| 711 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 717 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
| 712 IPC_END_MESSAGE_MAP() | 718 IPC_END_MESSAGE_MAP() |
| 713 | 719 |
| 714 return handled; | 720 return handled; |
| 715 } | 721 } |
| 716 | 722 |
| 717 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { | 723 void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 frame_->setCompositionFromExistingText(start, end, underlines); | 1186 frame_->setCompositionFromExistingText(start, end, underlines); |
| 1181 } | 1187 } |
| 1182 | 1188 |
| 1183 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { | 1189 void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) { |
| 1184 if (!GetRenderWidget()->ShouldHandleImeEvent()) | 1190 if (!GetRenderWidget()->ShouldHandleImeEvent()) |
| 1185 return; | 1191 return; |
| 1186 ImeEventGuard guard(GetRenderWidget()); | 1192 ImeEventGuard guard(GetRenderWidget()); |
| 1187 frame_->extendSelectionAndDelete(before, after); | 1193 frame_->extendSelectionAndDelete(before, after); |
| 1188 } | 1194 } |
| 1189 | 1195 |
| 1196 void RenderFrameImpl::OnSetAccessibilityMode(AccessibilityMode new_mode) { |
| 1197 if (accessibility_mode_ == new_mode) |
| 1198 return; |
| 1199 accessibility_mode_ = new_mode; |
| 1200 if (renderer_accessibility_) { |
| 1201 delete renderer_accessibility_; |
| 1202 renderer_accessibility_ = NULL; |
| 1203 } |
| 1204 if (accessibility_mode_ == AccessibilityModeOff) |
| 1205 return; |
| 1206 |
| 1207 if (accessibility_mode_ & AccessibilityModeFlagFullTree) |
| 1208 renderer_accessibility_ = new RendererAccessibilityComplete(this); |
| 1209 #if !defined(OS_ANDROID) |
| 1210 else |
| 1211 renderer_accessibility_ = new RendererAccessibilityFocusOnly(this); |
| 1212 #endif |
| 1213 } |
| 1190 | 1214 |
| 1191 void RenderFrameImpl::OnReload(bool ignore_cache) { | 1215 void RenderFrameImpl::OnReload(bool ignore_cache) { |
| 1192 frame_->reload(ignore_cache); | 1216 frame_->reload(ignore_cache); |
| 1193 } | 1217 } |
| 1194 | 1218 |
| 1195 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( | 1219 bool RenderFrameImpl::ShouldUpdateSelectionTextFromContextMenuParams( |
| 1196 const base::string16& selection_text, | 1220 const base::string16& selection_text, |
| 1197 size_t selection_text_offset, | 1221 size_t selection_text_offset, |
| 1198 const gfx::Range& selection_range, | 1222 const gfx::Range& selection_range, |
| 1199 const ContextMenuParams& params) { | 1223 const ContextMenuParams& params) { |
| (...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 // finished parsing the head, but webkit doesn't support that yet. | 3104 // finished parsing the head, but webkit doesn't support that yet. |
| 3081 // The feed discovery code would also benefit from access to the head. | 3105 // The feed discovery code would also benefit from access to the head. |
| 3082 if (!render_view_->is_loading()) | 3106 if (!render_view_->is_loading()) |
| 3083 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 3107 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
| 3084 } | 3108 } |
| 3085 | 3109 |
| 3086 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 3110 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
| 3087 render_view_->FrameDidChangeLoadProgress(frame_, load_progress); | 3111 render_view_->FrameDidChangeLoadProgress(frame_, load_progress); |
| 3088 } | 3112 } |
| 3089 | 3113 |
| 3114 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 3115 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 3116 if (renderer_accessibility_) |
| 3117 renderer_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 3118 } |
| 3119 |
| 3120 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 3121 if (renderer_accessibility_) |
| 3122 renderer_accessibility_->FocusedNodeChanged(node); |
| 3123 } |
| 3124 |
| 3090 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( | 3125 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
| 3091 RenderFrame* render_frame, | 3126 RenderFrame* render_frame, |
| 3092 WebFrame* frame, | 3127 WebFrame* frame, |
| 3093 WebDataSource::ExtraData* extraData, | 3128 WebDataSource::ExtraData* extraData, |
| 3094 const WebURLRequest& request, | 3129 const WebURLRequest& request, |
| 3095 WebNavigationType type, | 3130 WebNavigationType type, |
| 3096 WebNavigationPolicy default_policy, | 3131 WebNavigationPolicy default_policy, |
| 3097 bool is_redirect) { | 3132 bool is_redirect) { |
| 3098 #ifdef OS_ANDROID | 3133 #ifdef OS_ANDROID |
| 3099 // The handlenavigation API is deprecated and will be removed once | 3134 // The handlenavigation API is deprecated and will be removed once |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3501 weak_factory_.GetWeakPtr(), | 3536 weak_factory_.GetWeakPtr(), |
| 3502 render_view_->media_player_manager_, | 3537 render_view_->media_player_manager_, |
| 3503 stream_texture_factory, | 3538 stream_texture_factory, |
| 3504 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 3539 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
| 3505 new RenderMediaLog()); | 3540 new RenderMediaLog()); |
| 3506 } | 3541 } |
| 3507 | 3542 |
| 3508 #endif | 3543 #endif |
| 3509 | 3544 |
| 3510 } // namespace content | 3545 } // namespace content |
| OLD | NEW |