| 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/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "content/browser/child_process_security_policy_impl.h" | 13 #include "content/browser/child_process_security_policy_impl.h" |
| 14 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 14 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
| 15 #include "content/browser/frame_host/cross_site_transferring_request.h" | 15 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 16 #include "content/browser/frame_host/debug_urls.h" | 16 #include "content/browser/frame_host/debug_urls.h" |
| 17 #include "content/browser/frame_host/interstitial_page_impl.h" | 17 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 18 #include "content/browser/frame_host/navigation_controller_impl.h" | 18 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 19 #include "content/browser/frame_host/navigation_entry_impl.h" | 19 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 20 #include "content/browser/frame_host/navigation_request.h" |
| 21 #include "content/browser/frame_host/navigation_request_info.h" |
| 20 #include "content/browser/frame_host/navigator.h" | 22 #include "content/browser/frame_host/navigator.h" |
| 21 #include "content/browser/frame_host/render_frame_host_factory.h" | 23 #include "content/browser/frame_host/render_frame_host_factory.h" |
| 22 #include "content/browser/frame_host/render_frame_host_impl.h" | 24 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 23 #include "content/browser/frame_host/render_frame_proxy_host.h" | 25 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 24 #include "content/browser/renderer_host/render_process_host_impl.h" | 26 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 25 #include "content/browser/renderer_host/render_view_host_factory.h" | 27 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 26 #include "content/browser/renderer_host/render_view_host_impl.h" | 28 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 27 #include "content/browser/site_instance_impl.h" | 29 #include "content/browser/site_instance_impl.h" |
| 28 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 30 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 29 #include "content/browser/webui/web_ui_impl.h" | 31 #include "content/browser/webui/web_ui_impl.h" |
| 32 #include "content/common/frame_messages.h" |
| 30 #include "content/common/view_messages.h" | 33 #include "content/common/view_messages.h" |
| 31 #include "content/public/browser/content_browser_client.h" | 34 #include "content/public/browser/content_browser_client.h" |
| 32 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
| 34 #include "content/public/browser/render_widget_host_iterator.h" | 37 #include "content/public/browser/render_widget_host_iterator.h" |
| 35 #include "content/public/browser/render_widget_host_view.h" | 38 #include "content/public/browser/render_widget_host_view.h" |
| 36 #include "content/public/browser/user_metrics.h" | 39 #include "content/public/browser/user_metrics.h" |
| 37 #include "content/public/browser/web_ui_controller.h" | 40 #include "content/public/browser/web_ui_controller.h" |
| 38 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_switches.h" |
| 39 #include "content/public/common/url_constants.h" | 42 #include "content/public/common/url_constants.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 RFHPendingDeleteMap::iterator iter = | 563 RFHPendingDeleteMap::iterator iter = |
| 561 pending_delete_hosts_.find(site_instance_id); | 564 pending_delete_hosts_.find(site_instance_id); |
| 562 if (iter != pending_delete_hosts_.end() && iter->second.get() == rfh) | 565 if (iter != pending_delete_hosts_.end() && iter->second.get() == rfh) |
| 563 pending_delete_hosts_.erase(site_instance_id); | 566 pending_delete_hosts_.erase(site_instance_id); |
| 564 } | 567 } |
| 565 | 568 |
| 566 void RenderFrameHostManager::ResetProxyHosts() { | 569 void RenderFrameHostManager::ResetProxyHosts() { |
| 567 STLDeleteValues(&proxy_hosts_); | 570 STLDeleteValues(&proxy_hosts_); |
| 568 } | 571 } |
| 569 | 572 |
| 573 void RenderFrameHostManager::BeginNavigation( |
| 574 const FrameHostMsg_BeginNavigation_Params& params) { |
| 575 // TODO(clamy): Check if navigations are blocked and if so, return |
| 576 // immediately. |
| 577 NavigationRequestInfo info(params); |
| 578 |
| 579 info.first_party_for_cookies = frame_tree_node_->IsMainFrame() ? |
| 580 params.url : frame_tree_node_->frame_tree()->root()->current_url(); |
| 581 info.is_main_frame = frame_tree_node_->IsMainFrame(); |
| 582 info.parent_is_main_frame = !frame_tree_node_->parent() ? |
| 583 false : frame_tree_node_->parent()->IsMainFrame(); |
| 584 info.is_showing = GetRenderWidgetHostView()->IsShowing(); |
| 585 |
| 586 navigation_request_.reset( |
| 587 new NavigationRequest(info, frame_tree_node_->frame_tree_node_id())); |
| 588 navigation_request_->BeginNavigation(params.request_body); |
| 589 // TODO(clamy): If we have no live RenderFrameHost to handle the request (eg |
| 590 // cross-site navigation) spawn one speculatively here and keep track of it. |
| 591 } |
| 592 |
| 570 void RenderFrameHostManager::Observe( | 593 void RenderFrameHostManager::Observe( |
| 571 int type, | 594 int type, |
| 572 const NotificationSource& source, | 595 const NotificationSource& source, |
| 573 const NotificationDetails& details) { | 596 const NotificationDetails& details) { |
| 574 switch (type) { | 597 switch (type) { |
| 575 case NOTIFICATION_RENDERER_PROCESS_CLOSED: | 598 case NOTIFICATION_RENDERER_PROCESS_CLOSED: |
| 576 case NOTIFICATION_RENDERER_PROCESS_CLOSING: | 599 case NOTIFICATION_RENDERER_PROCESS_CLOSING: |
| 577 RendererProcessClosing( | 600 RendererProcessClosing( |
| 578 Source<RenderProcessHost>(source).ptr()); | 601 Source<RenderProcessHost>(source).ptr()); |
| 579 break; | 602 break; |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 SiteInstance* instance) const { | 1507 SiteInstance* instance) const { |
| 1485 RenderFrameProxyHostMap::const_iterator iter = | 1508 RenderFrameProxyHostMap::const_iterator iter = |
| 1486 proxy_hosts_.find(instance->GetId()); | 1509 proxy_hosts_.find(instance->GetId()); |
| 1487 if (iter != proxy_hosts_.end()) | 1510 if (iter != proxy_hosts_.end()) |
| 1488 return iter->second; | 1511 return iter->second; |
| 1489 | 1512 |
| 1490 return NULL; | 1513 return NULL; |
| 1491 } | 1514 } |
| 1492 | 1515 |
| 1493 } // namespace content | 1516 } // namespace content |
| OLD | NEW |