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