| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/test_render_view_host_factory.h" | 5 #include "content/test/test_render_view_host_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/public/browser/render_process_host_factory.h" | 10 #include "content/public/browser/render_process_host_factory.h" |
| 11 #include "content/test/test_render_view_host.h" | 11 #include "content/test/test_render_view_host.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 TestRenderViewHostFactory::TestRenderViewHostFactory( | 15 TestRenderViewHostFactory::TestRenderViewHostFactory( |
| 16 RenderProcessHostFactory* rph_factory) { | 16 RenderProcessHostFactory* rph_factory) { |
| 17 SiteInstanceImpl::set_render_process_host_factory(rph_factory); | 17 RenderProcessHostImpl::set_render_process_host_factory(rph_factory); |
| 18 RenderViewHostFactory::RegisterFactory(this); | 18 RenderViewHostFactory::RegisterFactory(this); |
| 19 } | 19 } |
| 20 | 20 |
| 21 TestRenderViewHostFactory::~TestRenderViewHostFactory() { | 21 TestRenderViewHostFactory::~TestRenderViewHostFactory() { |
| 22 RenderViewHostFactory::UnregisterFactory(); | 22 RenderViewHostFactory::UnregisterFactory(); |
| 23 SiteInstanceImpl::set_render_process_host_factory(NULL); | 23 RenderProcessHostImpl::set_render_process_host_factory(NULL); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void TestRenderViewHostFactory::set_render_process_host_factory( | 26 void TestRenderViewHostFactory::set_render_process_host_factory( |
| 27 RenderProcessHostFactory* rph_factory) { | 27 RenderProcessHostFactory* rph_factory) { |
| 28 SiteInstanceImpl::set_render_process_host_factory(rph_factory); | 28 RenderProcessHostImpl::set_render_process_host_factory(rph_factory); |
| 29 } | 29 } |
| 30 | 30 |
| 31 RenderViewHost* TestRenderViewHostFactory::CreateRenderViewHost( | 31 RenderViewHost* TestRenderViewHostFactory::CreateRenderViewHost( |
| 32 SiteInstance* instance, | 32 SiteInstance* instance, |
| 33 RenderViewHostDelegate* delegate, | 33 RenderViewHostDelegate* delegate, |
| 34 RenderWidgetHostDelegate* widget_delegate, | 34 RenderWidgetHostDelegate* widget_delegate, |
| 35 int32_t routing_id, | 35 int32_t routing_id, |
| 36 int32_t main_frame_routing_id, | 36 int32_t main_frame_routing_id, |
| 37 bool swapped_out) { | 37 bool swapped_out) { |
| 38 return new TestRenderViewHost(instance, | 38 return new TestRenderViewHost(instance, |
| 39 base::MakeUnique<RenderWidgetHostImpl>( | 39 base::MakeUnique<RenderWidgetHostImpl>( |
| 40 widget_delegate, instance->GetProcess(), | 40 widget_delegate, instance->GetProcess(), |
| 41 routing_id, false /* hidden */), | 41 routing_id, false /* hidden */), |
| 42 delegate, main_frame_routing_id, swapped_out); | 42 delegate, main_frame_routing_id, swapped_out); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace content | 45 } // namespace content |
| OLD | NEW |