| 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_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 502 |
| 503 // The process may (if we're sharing a process with another host that already | 503 // The process may (if we're sharing a process with another host that already |
| 504 // initialized it) or may not (we have our own process or the old process | 504 // initialized it) or may not (we have our own process or the old process |
| 505 // crashed) have been initialized. Calling Init multiple times will be | 505 // crashed) have been initialized. Calling Init multiple times will be |
| 506 // ignored, so this is safe. | 506 // ignored, so this is safe. |
| 507 if (!GetProcess()->Init()) | 507 if (!GetProcess()->Init()) |
| 508 return false; | 508 return false; |
| 509 | 509 |
| 510 DCHECK(GetProcess()->HasConnection()); | 510 DCHECK(GetProcess()->HasConnection()); |
| 511 | 511 |
| 512 Send(new FrameMsg_NewFrame(routing_id_, parent_routing_id, proxy_routing_id)); | 512 Send(new FrameMsg_NewFrame(routing_id_, parent_routing_id, proxy_routing_id, |
| 513 frame_tree_node()->current_replication_state())); |
| 513 | 514 |
| 514 // The renderer now has a RenderFrame for this RenderFrameHost. Note that | 515 // The renderer now has a RenderFrame for this RenderFrameHost. Note that |
| 515 // this path is only used for out-of-process iframes. Main frame RenderFrames | 516 // this path is only used for out-of-process iframes. Main frame RenderFrames |
| 516 // are created with their RenderView, and same-site iframes are created at the | 517 // are created with their RenderView, and same-site iframes are created at the |
| 517 // time of OnCreateChildFrame. | 518 // time of OnCreateChildFrame. |
| 518 set_render_frame_created(true); | 519 set_render_frame_created(true); |
| 519 | 520 |
| 520 return true; | 521 return true; |
| 521 } | 522 } |
| 522 | 523 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 550 int32 resolved_level = | 551 int32 resolved_level = |
| 551 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()) ? level : 0; | 552 HasWebUIScheme(delegate_->GetMainFrameLastCommittedURL()) ? level : 0; |
| 552 | 553 |
| 553 if (resolved_level >= ::logging::GetMinLogLevel()) { | 554 if (resolved_level >= ::logging::GetMinLogLevel()) { |
| 554 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" << | 555 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" << |
| 555 message << "\", source: " << source_id << " (" << line_no << ")"; | 556 message << "\", source: " << source_id << " (" << line_no << ")"; |
| 556 } | 557 } |
| 557 } | 558 } |
| 558 | 559 |
| 559 void RenderFrameHostImpl::OnCreateChildFrame(int new_routing_id, | 560 void RenderFrameHostImpl::OnCreateChildFrame(int new_routing_id, |
| 560 const std::string& frame_name) { | 561 const std::string& frame_name, |
| 562 SandboxFlags sandbox_flags) { |
| 561 // It is possible that while a new RenderFrameHost was committed, the | 563 // It is possible that while a new RenderFrameHost was committed, the |
| 562 // RenderFrame corresponding to this host sent an IPC message to create a | 564 // RenderFrame corresponding to this host sent an IPC message to create a |
| 563 // frame and it is delivered after this host is swapped out. | 565 // frame and it is delivered after this host is swapped out. |
| 564 // Ignore such messages, as we know this RenderFrameHost is going away. | 566 // Ignore such messages, as we know this RenderFrameHost is going away. |
| 565 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) | 567 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) |
| 566 return; | 568 return; |
| 567 | 569 |
| 568 RenderFrameHostImpl* new_frame = frame_tree_->AddFrame( | 570 RenderFrameHostImpl* new_frame = frame_tree_->AddFrame( |
| 569 frame_tree_node_, GetProcess()->GetID(), new_routing_id, frame_name); | 571 frame_tree_node_, GetProcess()->GetID(), new_routing_id, frame_name); |
| 570 if (!new_frame) | 572 if (!new_frame) |
| 571 return; | 573 return; |
| 572 | 574 |
| 573 // We know that the RenderFrame has been created in this case, immediately | 575 // We know that the RenderFrame has been created in this case, immediately |
| 574 // after the CreateChildFrame IPC was sent. | 576 // after the CreateChildFrame IPC was sent. |
| 575 new_frame->set_render_frame_created(true); | 577 new_frame->set_render_frame_created(true); |
| 576 | 578 |
| 579 new_frame->frame_tree_node()->set_sandbox_flags(sandbox_flags); |
| 580 |
| 577 if (delegate_) | 581 if (delegate_) |
| 578 delegate_->RenderFrameCreated(new_frame); | 582 delegate_->RenderFrameCreated(new_frame); |
| 579 } | 583 } |
| 580 | 584 |
| 581 void RenderFrameHostImpl::OnDetach() { | 585 void RenderFrameHostImpl::OnDetach() { |
| 582 frame_tree_->RemoveFrame(frame_tree_node_); | 586 frame_tree_->RemoveFrame(frame_tree_node_); |
| 583 } | 587 } |
| 584 | 588 |
| 585 void RenderFrameHostImpl::OnFrameFocused() { | 589 void RenderFrameHostImpl::OnFrameFocused() { |
| 586 frame_tree_->SetFocusedFrame(frame_tree_node_); | 590 frame_tree_->SetFocusedFrame(frame_tree_node_); |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1612 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
| 1609 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1613 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
| 1610 GetContentClient()->browser()->RegisterPermissionUsage( | 1614 GetContentClient()->browser()->RegisterPermissionUsage( |
| 1611 PERMISSION_GEOLOCATION, | 1615 PERMISSION_GEOLOCATION, |
| 1612 delegate_->GetAsWebContents(), | 1616 delegate_->GetAsWebContents(), |
| 1613 GetLastCommittedURL().GetOrigin(), | 1617 GetLastCommittedURL().GetOrigin(), |
| 1614 top_frame->GetLastCommittedURL().GetOrigin()); | 1618 top_frame->GetLastCommittedURL().GetOrigin()); |
| 1615 } | 1619 } |
| 1616 | 1620 |
| 1617 } // namespace content | 1621 } // namespace content |
| OLD | NEW |