OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/render_view_host_manager.h" | 5 #include "content/browser/tab_contents/render_view_host_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/browser/content_browser_client.h" | 9 #include "content/browser/content_browser_client.h" |
10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 // no pending response in the ResourceDispatcherHost to unpause. | 807 // no pending response in the ResourceDispatcherHost to unpause. |
808 render_view_host_->SwapOut(-1, -1); | 808 render_view_host_->SwapOut(-1, -1); |
809 | 809 |
810 // Swap in the new view and make it active. | 810 // Swap in the new view and make it active. |
811 RenderViewHost* old_render_view_host = render_view_host_; | 811 RenderViewHost* old_render_view_host = render_view_host_; |
812 render_view_host_ = rvh; | 812 render_view_host_ = rvh; |
813 render_view_host_->set_delegate(render_view_delegate_); | 813 render_view_host_->set_delegate(render_view_delegate_); |
814 // Remove old RenderWidgetHostView with mocked out methods so it can be | 814 // Remove old RenderWidgetHostView with mocked out methods so it can be |
815 // replaced with a new one that's a child of |delegate_|'s view. | 815 // replaced with a new one that's a child of |delegate_|'s view. |
816 scoped_ptr<RenderWidgetHostView> old_view(render_view_host_->view()); | 816 scoped_ptr<RenderWidgetHostView> old_view(render_view_host_->view()); |
817 render_view_host_->set_view(NULL); | 817 render_view_host_->SetView(NULL); |
818 delegate_->CreateViewAndSetSizeForRVH(render_view_host_); | 818 delegate_->CreateViewAndSetSizeForRVH(render_view_host_); |
819 render_view_host_->ActivateDeferredPluginHandles(); | 819 render_view_host_->ActivateDeferredPluginHandles(); |
820 // If the view is gone, then this RenderViewHost died while it was hidden. | 820 // If the view is gone, then this RenderViewHost died while it was hidden. |
821 // We ignored the RenderViewGone call at the time, so we should send it now | 821 // We ignored the RenderViewGone call at the time, so we should send it now |
822 // to make sure the sad tab shows up, etc. | 822 // to make sure the sad tab shows up, etc. |
823 if (render_view_host_->view()) { | 823 if (render_view_host_->view()) { |
824 // The Hide() is needed to sync the state of |render_view_host_|, which is | 824 // The Hide() is needed to sync the state of |render_view_host_|, which is |
825 // hidden, with the newly created view, which does not know the | 825 // hidden, with the newly created view, which does not know the |
826 // RenderViewHost is hidden. | 826 // RenderViewHost is hidden. |
827 // TODO(tburkard,cbentzel): Figure out if this hack can be removed | 827 // TODO(tburkard,cbentzel): Figure out if this hack can be removed |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 delegate_->NotifySwappedFromRenderManager(); | 864 delegate_->NotifySwappedFromRenderManager(); |
865 } | 865 } |
866 | 866 |
867 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 867 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
868 if (!rvh->site_instance()) | 868 if (!rvh->site_instance()) |
869 return false; | 869 return false; |
870 | 870 |
871 return swapped_out_hosts_.find(rvh->site_instance()->id()) != | 871 return swapped_out_hosts_.find(rvh->site_instance()->id()) != |
872 swapped_out_hosts_.end(); | 872 swapped_out_hosts_.end(); |
873 } | 873 } |
OLD | NEW |