diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 16:48:07 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 16:48:07 +0000 |
commit | 3ff3493b8904ee4db7b41cd1676ccdcb127ecbd8 (patch) | |
tree | 6d3dcf4bf6a0f19d553a3e1a2c2eba0a81e72ce3 /chrome/browser/renderer_host/render_view_host_factory.cc | |
parent | a64691f2882ea7403dc2fcd39f026583e12429fe (diff) | |
download | chromium_src-3ff3493b8904ee4db7b41cd1676ccdcb127ecbd8.zip chromium_src-3ff3493b8904ee4db7b41cd1676ccdcb127ecbd8.tar.gz chromium_src-3ff3493b8904ee4db7b41cd1676ccdcb127ecbd8.tar.bz2 |
Make the RenderViewHostFactory a global. This prevents us from having to pass
a factory pointer around all the time. Removing TestTabContents will require
making the Browser object keep track of the Factory pointer as well, so I think
the global is the best approach and cleans some things up.
Review URL: http://codereview.chromium.org/62044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host/render_view_host_factory.cc')
-rw-r--r-- | chrome/browser/renderer_host/render_view_host_factory.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/render_view_host_factory.cc b/chrome/browser/renderer_host/render_view_host_factory.cc new file mode 100644 index 0000000..38af233 --- /dev/null +++ b/chrome/browser/renderer_host/render_view_host_factory.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/renderer_host/render_view_host_factory.h" + +#include "base/logging.h" +#include "chrome/browser/renderer_host/render_view_host.h" + +// static +RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; + +// static +RenderViewHost* RenderViewHostFactory::Create( + SiteInstance* instance, + RenderViewHostDelegate* delegate, + int routing_id, + base::WaitableEvent* modal_dialog_event) { + if (factory_) { + return factory_->CreateRenderViewHost(instance, delegate, + routing_id, modal_dialog_event); + } + return new RenderViewHost(instance, delegate, routing_id, modal_dialog_event); +} + +// static +void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { + DCHECK(!factory_) << "Can't register two factories at once."; + factory_ = factory; +} + +// static +void RenderViewHostFactory::UnregisterFactory() { + DCHECK(factory_) << "No factory to unregister."; + factory_ = NULL; +} |