| 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/browser/browser_url_handler.h" | 5 #include "content/browser/browser_url_handler.h" |
| 6 #include "content/browser/renderer_host/test_backing_store.h" | 6 #include "content/browser/renderer_host/test_backing_store.h" |
| 7 #include "content/browser/renderer_host/test_render_view_host.h" | 7 #include "content/browser/renderer_host/test_render_view_host.h" |
| 8 #include "content/browser/site_instance_impl.h" | 8 #include "content/browser/site_instance_impl.h" |
| 9 #include "content/browser/tab_contents/navigation_controller_impl.h" | 9 #include "content/browser/tab_contents/navigation_controller_impl.h" |
| 10 #include "content/browser/tab_contents/navigation_entry_impl.h" | 10 #include "content/browser/tab_contents/navigation_entry_impl.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 int routing_id) | 72 int routing_id) |
| 73 : RenderViewHost(instance, delegate, routing_id, | 73 : RenderViewHost(instance, delegate, routing_id, |
| 74 kInvalidSessionStorageNamespaceId), | 74 kInvalidSessionStorageNamespaceId), |
| 75 render_view_created_(false), | 75 render_view_created_(false), |
| 76 delete_counter_(NULL), | 76 delete_counter_(NULL), |
| 77 simulate_fetch_via_proxy_(false), | 77 simulate_fetch_via_proxy_(false), |
| 78 contents_mime_type_("text/html") { | 78 contents_mime_type_("text/html") { |
| 79 // For normal RenderViewHosts, this is freed when |Shutdown()| is called. | 79 // For normal RenderViewHosts, this is freed when |Shutdown()| is called. |
| 80 // For TestRenderViewHost, the view is explicitly deleted in the destructor | 80 // For TestRenderViewHost, the view is explicitly deleted in the destructor |
| 81 // below, because TestRenderWidgetHostView::Destroy() doesn't |delete this|. | 81 // below, because TestRenderWidgetHostView::Destroy() doesn't |delete this|. |
| 82 SetView(new TestRenderWidgetHostView(this)); | 82 SetView(new content::TestRenderWidgetHostView(this)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 TestRenderViewHost::~TestRenderViewHost() { | 85 TestRenderViewHost::~TestRenderViewHost() { |
| 86 if (delete_counter_) | 86 if (delete_counter_) |
| 87 ++*delete_counter_; | 87 ++*delete_counter_; |
| 88 | 88 |
| 89 // Since this isn't a traditional view, we have to delete it. | 89 // Since this isn't a traditional view, we have to delete it. |
| 90 delete view(); | 90 delete view(); |
| 91 } | 91 } |
| 92 | 92 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) { | 149 void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) { |
| 150 simulate_fetch_via_proxy_ = proxy; | 150 simulate_fetch_via_proxy_ = proxy; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void TestRenderViewHost::set_contents_mime_type(const std::string& mime_type) { | 153 void TestRenderViewHost::set_contents_mime_type(const std::string& mime_type) { |
| 154 contents_mime_type_ = mime_type; | 154 contents_mime_type_ = mime_type; |
| 155 } | 155 } |
| 156 | 156 |
| 157 namespace content { |
| 158 |
| 157 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) | 159 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) |
| 158 : rwh_(rwh), | 160 : rwh_(rwh), |
| 159 is_showing_(false) { | 161 is_showing_(false) { |
| 160 } | 162 } |
| 161 | 163 |
| 162 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 164 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
| 163 } | 165 } |
| 164 | 166 |
| 165 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 167 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
| 166 return NULL; | 168 return NULL; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 return gfx::GLSurfaceHandle(); | 301 return gfx::GLSurfaceHandle(); |
| 300 } | 302 } |
| 301 | 303 |
| 302 bool TestRenderWidgetHostView::LockMouse() { | 304 bool TestRenderWidgetHostView::LockMouse() { |
| 303 return false; | 305 return false; |
| 304 } | 306 } |
| 305 | 307 |
| 306 void TestRenderWidgetHostView::UnlockMouse() { | 308 void TestRenderWidgetHostView::UnlockMouse() { |
| 307 } | 309 } |
| 308 | 310 |
| 311 } // namespace content |
| 312 |
| 309 TestRenderViewHostFactory::TestRenderViewHostFactory( | 313 TestRenderViewHostFactory::TestRenderViewHostFactory( |
| 310 content::RenderProcessHostFactory* rph_factory) | 314 content::RenderProcessHostFactory* rph_factory) |
| 311 : render_process_host_factory_(rph_factory) { | 315 : render_process_host_factory_(rph_factory) { |
| 312 RenderViewHostFactory::RegisterFactory(this); | 316 RenderViewHostFactory::RegisterFactory(this); |
| 313 } | 317 } |
| 314 | 318 |
| 315 TestRenderViewHostFactory::~TestRenderViewHostFactory() { | 319 TestRenderViewHostFactory::~TestRenderViewHostFactory() { |
| 316 RenderViewHostFactory::UnregisterFactory(); | 320 RenderViewHostFactory::UnregisterFactory(); |
| 317 } | 321 } |
| 318 | 322 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 SetContents(NULL); | 414 SetContents(NULL); |
| 411 | 415 |
| 412 // Make sure that we flush any messages related to TabContents destruction | 416 // Make sure that we flush any messages related to TabContents destruction |
| 413 // before we destroy the browser context. | 417 // before we destroy the browser context. |
| 414 MessageLoop::current()->RunAllPending(); | 418 MessageLoop::current()->RunAllPending(); |
| 415 | 419 |
| 416 // Release the browser context on the UI thread. | 420 // Release the browser context on the UI thread. |
| 417 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 421 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 418 message_loop_.RunAllPending(); | 422 message_loop_.RunAllPending(); |
| 419 } | 423 } |
| OLD | NEW |