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 29 matching lines...) Expand all Loading... |
552 | 553 |
553 // LogMessages can be persisted so this shouldn't be logged in incognito mode. | 554 // LogMessages can be persisted so this shouldn't be logged in incognito mode. |
554 if (resolved_level >= ::logging::GetMinLogLevel() | 555 if (resolved_level >= ::logging::GetMinLogLevel() |
555 && !GetSiteInstance()->GetBrowserContext()->IsOffTheRecord()) { | 556 && !GetSiteInstance()->GetBrowserContext()->IsOffTheRecord()) { |
556 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" << | 557 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" << |
557 message << "\", source: " << source_id << " (" << line_no << ")"; | 558 message << "\", source: " << source_id << " (" << line_no << ")"; |
558 } | 559 } |
559 } | 560 } |
560 | 561 |
561 void RenderFrameHostImpl::OnCreateChildFrame(int new_routing_id, | 562 void RenderFrameHostImpl::OnCreateChildFrame(int new_routing_id, |
562 const std::string& frame_name) { | 563 const std::string& frame_name, |
| 564 SandboxFlags sandbox_flags) { |
563 // It is possible that while a new RenderFrameHost was committed, the | 565 // It is possible that while a new RenderFrameHost was committed, the |
564 // RenderFrame corresponding to this host sent an IPC message to create a | 566 // RenderFrame corresponding to this host sent an IPC message to create a |
565 // frame and it is delivered after this host is swapped out. | 567 // frame and it is delivered after this host is swapped out. |
566 // Ignore such messages, as we know this RenderFrameHost is going away. | 568 // Ignore such messages, as we know this RenderFrameHost is going away. |
567 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) | 569 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) |
568 return; | 570 return; |
569 | 571 |
570 RenderFrameHostImpl* new_frame = frame_tree_->AddFrame( | 572 RenderFrameHostImpl* new_frame = frame_tree_->AddFrame( |
571 frame_tree_node_, GetProcess()->GetID(), new_routing_id, frame_name); | 573 frame_tree_node_, GetProcess()->GetID(), new_routing_id, frame_name); |
572 if (!new_frame) | 574 if (!new_frame) |
573 return; | 575 return; |
574 | 576 |
575 // We know that the RenderFrame has been created in this case, immediately | 577 // We know that the RenderFrame has been created in this case, immediately |
576 // after the CreateChildFrame IPC was sent. | 578 // after the CreateChildFrame IPC was sent. |
577 new_frame->set_render_frame_created(true); | 579 new_frame->set_render_frame_created(true); |
578 | 580 |
| 581 new_frame->frame_tree_node()->set_sandbox_flags(sandbox_flags); |
| 582 |
579 if (delegate_) | 583 if (delegate_) |
580 delegate_->RenderFrameCreated(new_frame); | 584 delegate_->RenderFrameCreated(new_frame); |
581 } | 585 } |
582 | 586 |
583 void RenderFrameHostImpl::OnDetach() { | 587 void RenderFrameHostImpl::OnDetach() { |
584 frame_tree_->RemoveFrame(frame_tree_node_); | 588 frame_tree_->RemoveFrame(frame_tree_node_); |
585 } | 589 } |
586 | 590 |
587 void RenderFrameHostImpl::OnFrameFocused() { | 591 void RenderFrameHostImpl::OnFrameFocused() { |
588 frame_tree_->SetFocusedFrame(frame_tree_node_); | 592 frame_tree_->SetFocusedFrame(frame_tree_node_); |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1618 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1615 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1619 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1616 GetContentClient()->browser()->RegisterPermissionUsage( | 1620 GetContentClient()->browser()->RegisterPermissionUsage( |
1617 PERMISSION_GEOLOCATION, | 1621 PERMISSION_GEOLOCATION, |
1618 delegate_->GetAsWebContents(), | 1622 delegate_->GetAsWebContents(), |
1619 GetLastCommittedURL().GetOrigin(), | 1623 GetLastCommittedURL().GetOrigin(), |
1620 top_frame->GetLastCommittedURL().GetOrigin()); | 1624 top_frame->GetLastCommittedURL().GetOrigin()); |
1621 } | 1625 } |
1622 | 1626 |
1623 } // namespace content | 1627 } // namespace content |
OLD | NEW |