| 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 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 is_using_lofi_(false), | 1117 is_using_lofi_(false), |
| 1118 effective_connection_type_( | 1118 effective_connection_type_( |
| 1119 blink::WebEffectiveConnectionType::TypeUnknown), | 1119 blink::WebEffectiveConnectionType::TypeUnknown), |
| 1120 is_pasting_(false), | 1120 is_pasting_(false), |
| 1121 suppress_further_dialogs_(false), | 1121 suppress_further_dialogs_(false), |
| 1122 blame_context_(nullptr), | 1122 blame_context_(nullptr), |
| 1123 #if BUILDFLAG(ENABLE_PLUGINS) | 1123 #if BUILDFLAG(ENABLE_PLUGINS) |
| 1124 focused_pepper_plugin_(nullptr), | 1124 focused_pepper_plugin_(nullptr), |
| 1125 pepper_last_mouse_event_target_(nullptr), | 1125 pepper_last_mouse_event_target_(nullptr), |
| 1126 #endif | 1126 #endif |
| 1127 engagement_binding_(this), |
| 1127 frame_binding_(this), | 1128 frame_binding_(this), |
| 1128 host_zoom_binding_(this), | 1129 host_zoom_binding_(this), |
| 1129 has_accessed_initial_document_(false), | 1130 has_accessed_initial_document_(false), |
| 1130 weak_factory_(this) { | 1131 weak_factory_(this) { |
| 1131 // We don't have a service_manager::Connection at this point, so use empty | 1132 // We don't have a service_manager::Connection at this point, so use empty |
| 1132 // identity/specs. | 1133 // identity/specs. |
| 1133 // TODO(beng): We should fix this, so we can apply policy about which | 1134 // TODO(beng): We should fix this, so we can apply policy about which |
| 1134 // interfaces get exposed. | 1135 // interfaces get exposed. |
| 1135 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( | 1136 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( |
| 1136 mojom::kNavigation_FrameSpec); | 1137 mojom::kNavigation_FrameSpec); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 // Can be NULL in tests. | 1642 // Can be NULL in tests. |
| 1642 if (render_thread_impl) | 1643 if (render_thread_impl) |
| 1643 render_thread_impl->GetRendererScheduler()->OnNavigationStarted(); | 1644 render_thread_impl->GetRendererScheduler()->OnNavigationStarted(); |
| 1644 DCHECK(!IsBrowserSideNavigationEnabled()); | 1645 DCHECK(!IsBrowserSideNavigationEnabled()); |
| 1645 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::OnNavigate", "id", | 1646 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::OnNavigate", "id", |
| 1646 routing_id_, "url", common_params.url.possibly_invalid_spec()); | 1647 routing_id_, "url", common_params.url.possibly_invalid_spec()); |
| 1647 NavigateInternal(common_params, start_params, request_params, | 1648 NavigateInternal(common_params, start_params, request_params, |
| 1648 std::unique_ptr<StreamOverrideParameters>()); | 1649 std::unique_ptr<StreamOverrideParameters>()); |
| 1649 } | 1650 } |
| 1650 | 1651 |
| 1651 void RenderFrameImpl::Bind(mojom::FrameRequest request, | 1652 void RenderFrameImpl::BindEngagement( |
| 1652 mojom::FrameHostPtr host) { | 1653 blink::mojom::EngagementClientAssociatedRequest request) { |
| 1654 engagement_binding_.Bind(std::move(request)); |
| 1655 } |
| 1656 |
| 1657 void RenderFrameImpl::BindFrame(mojom::FrameRequest request, |
| 1658 mojom::FrameHostPtr host) { |
| 1653 frame_binding_.Bind(std::move(request)); | 1659 frame_binding_.Bind(std::move(request)); |
| 1654 frame_host_ = std::move(host); | 1660 frame_host_ = std::move(host); |
| 1655 frame_host_->GetInterfaceProvider( | 1661 frame_host_->GetInterfaceProvider( |
| 1656 std::move(pending_remote_interface_provider_request_)); | 1662 std::move(pending_remote_interface_provider_request_)); |
| 1657 } | 1663 } |
| 1658 | 1664 |
| 1659 ManifestManager* RenderFrameImpl::manifest_manager() { | 1665 ManifestManager* RenderFrameImpl::manifest_manager() { |
| 1660 return manifest_manager_; | 1666 return manifest_manager_; |
| 1661 } | 1667 } |
| 1662 | 1668 |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 } | 2664 } |
| 2659 | 2665 |
| 2660 bool RenderFrameImpl::IsUsingLoFi() const { | 2666 bool RenderFrameImpl::IsUsingLoFi() const { |
| 2661 return is_using_lofi_; | 2667 return is_using_lofi_; |
| 2662 } | 2668 } |
| 2663 | 2669 |
| 2664 bool RenderFrameImpl::IsPasting() const { | 2670 bool RenderFrameImpl::IsPasting() const { |
| 2665 return is_pasting_; | 2671 return is_pasting_; |
| 2666 } | 2672 } |
| 2667 | 2673 |
| 2674 // blink::mojom::EngagementClient implementation ------------------------------- |
| 2675 |
| 2676 void RenderFrameImpl::SetEngagementLevel(const url::Origin& origin, |
| 2677 blink::mojom::EngagementLevel level) { |
| 2678 // Set the engagement level on |frame_| if its origin matches the one we have |
| 2679 // been provided with. |
| 2680 if (frame_ && url::Origin(frame_->getSecurityOrigin()) == origin) { |
| 2681 frame_->setEngagementLevel(level); |
| 2682 return; |
| 2683 } |
| 2684 |
| 2685 engagement_levels_[origin] = level; |
| 2686 } |
| 2687 |
| 2668 // mojom::Frame implementation ------------------------------------------------- | 2688 // mojom::Frame implementation ------------------------------------------------- |
| 2669 | 2689 |
| 2670 void RenderFrameImpl::GetInterfaceProvider( | 2690 void RenderFrameImpl::GetInterfaceProvider( |
| 2671 service_manager::mojom::InterfaceProviderRequest request) { | 2691 service_manager::mojom::InterfaceProviderRequest request) { |
| 2672 service_manager::ServiceInfo child_info = | 2692 service_manager::ServiceInfo child_info = |
| 2673 ChildThreadImpl::current()->GetChildServiceInfo(); | 2693 ChildThreadImpl::current()->GetChildServiceInfo(); |
| 2674 service_manager::ServiceInfo browser_info = | 2694 service_manager::ServiceInfo browser_info = |
| 2675 ChildThreadImpl::current()->GetBrowserServiceInfo(); | 2695 ChildThreadImpl::current()->GetBrowserServiceInfo(); |
| 2676 | 2696 |
| 2677 service_manager::InterfaceProviderSpec child_spec, browser_spec; | 2697 service_manager::InterfaceProviderSpec child_spec, browser_spec; |
| (...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4755 | 4775 |
| 4756 const WebURLRequest& request = ds->request(); | 4776 const WebURLRequest& request = ds->request(); |
| 4757 const WebURLResponse& response = ds->response(); | 4777 const WebURLResponse& response = ds->response(); |
| 4758 | 4778 |
| 4759 DocumentState* document_state = DocumentState::FromDataSource(ds); | 4779 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 4760 NavigationStateImpl* navigation_state = | 4780 NavigationStateImpl* navigation_state = |
| 4761 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 4781 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| 4762 InternalDocumentStateData* internal_data = | 4782 InternalDocumentStateData* internal_data = |
| 4763 InternalDocumentStateData::FromDocumentState(document_state); | 4783 InternalDocumentStateData::FromDocumentState(document_state); |
| 4764 | 4784 |
| 4785 // Set the correct engagement level on the frame. |
| 4786 EngagementLevels::iterator engagement_level = |
| 4787 engagement_levels_.find(url::Origin(frame_->getSecurityOrigin())); |
| 4788 |
| 4789 if (engagement_level != engagement_levels_.end()) |
| 4790 frame_->setEngagementLevel(engagement_level->second); |
| 4791 engagement_levels_.clear(); |
| 4792 |
| 4765 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 4793 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 4766 params.http_status_code = response.httpStatusCode(); | 4794 params.http_status_code = response.httpStatusCode(); |
| 4767 params.url_is_unreachable = ds->hasUnreachableURL(); | 4795 params.url_is_unreachable = ds->hasUnreachableURL(); |
| 4768 params.method = "GET"; | 4796 params.method = "GET"; |
| 4769 params.intended_as_new_entry = | 4797 params.intended_as_new_entry = |
| 4770 navigation_state->request_params().intended_as_new_entry; | 4798 navigation_state->request_params().intended_as_new_entry; |
| 4771 params.did_create_new_entry = commit_type == blink::WebStandardCommit; | 4799 params.did_create_new_entry = commit_type == blink::WebStandardCommit; |
| 4772 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); | 4800 params.should_replace_current_entry = ds->replacesCurrentHistoryItem(); |
| 4773 params.post_id = -1; | 4801 params.post_id = -1; |
| 4774 params.nav_entry_id = navigation_state->request_params().nav_entry_id; | 4802 params.nav_entry_id = navigation_state->request_params().nav_entry_id; |
| (...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6506 // Mimics the order of events sent by WebKit. | 6534 // Mimics the order of events sent by WebKit. |
| 6507 // See WebCore::Editor::setComposition() for the corresponding code. | 6535 // See WebCore::Editor::setComposition() for the corresponding code. |
| 6508 focused_pepper_plugin_->HandleCompositionEnd(text); | 6536 focused_pepper_plugin_->HandleCompositionEnd(text); |
| 6509 focused_pepper_plugin_->HandleTextInput(text); | 6537 focused_pepper_plugin_->HandleTextInput(text); |
| 6510 } | 6538 } |
| 6511 pepper_composition_text_.clear(); | 6539 pepper_composition_text_.clear(); |
| 6512 } | 6540 } |
| 6513 #endif // ENABLE_PLUGINS | 6541 #endif // ENABLE_PLUGINS |
| 6514 | 6542 |
| 6515 void RenderFrameImpl::RegisterMojoInterfaces() { | 6543 void RenderFrameImpl::RegisterMojoInterfaces() { |
| 6544 GetAssociatedInterfaceRegistry()->AddInterface( |
| 6545 base::Bind(&RenderFrameImpl::BindEngagement, weak_factory_.GetWeakPtr())); |
| 6546 |
| 6516 if (!frame_->parent()) { | 6547 if (!frame_->parent()) { |
| 6517 // Only main frame have ImageDownloader service. | 6548 // Only main frame have ImageDownloader service. |
| 6518 GetInterfaceRegistry()->AddInterface(base::Bind( | 6549 GetInterfaceRegistry()->AddInterface(base::Bind( |
| 6519 &ImageDownloaderImpl::CreateMojoService, base::Unretained(this))); | 6550 &ImageDownloaderImpl::CreateMojoService, base::Unretained(this))); |
| 6520 | 6551 |
| 6521 // Host zoom is per-page, so only added on the main frame. | 6552 // Host zoom is per-page, so only added on the main frame. |
| 6522 GetAssociatedInterfaceRegistry()->AddInterface(base::Bind( | 6553 GetAssociatedInterfaceRegistry()->AddInterface(base::Bind( |
| 6523 &RenderFrameImpl::OnHostZoomClientRequest, weak_factory_.GetWeakPtr())); | 6554 &RenderFrameImpl::OnHostZoomClientRequest, weak_factory_.GetWeakPtr())); |
| 6524 } | 6555 } |
| 6525 } | 6556 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6696 // event target. Potentially a Pepper plugin will receive the event. | 6727 // event target. Potentially a Pepper plugin will receive the event. |
| 6697 // In order to tell whether a plugin gets the last mouse event and which it | 6728 // In order to tell whether a plugin gets the last mouse event and which it |
| 6698 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6729 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6699 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6730 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6700 // |pepper_last_mouse_event_target_|. | 6731 // |pepper_last_mouse_event_target_|. |
| 6701 pepper_last_mouse_event_target_ = nullptr; | 6732 pepper_last_mouse_event_target_ = nullptr; |
| 6702 #endif | 6733 #endif |
| 6703 } | 6734 } |
| 6704 | 6735 |
| 6705 } // namespace content | 6736 } // namespace content |
| OLD | NEW |