diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 12:05:48 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 12:05:48 +0000 |
commit | f85d541dfff6b40ede739d3c0c3094ba420bafa2 (patch) | |
tree | 05fdc391e65feef0bb971230da16e5cc65ed1d51 /chrome/browser/debugger/devtools_manager.cc | |
parent | ea29a8a5bebf9c4fcf2448c6e4ddeafa62eba1d8 (diff) | |
download | chromium_src-f85d541dfff6b40ede739d3c0c3094ba420bafa2.zip chromium_src-f85d541dfff6b40ede739d3c0c3094ba420bafa2.tar.gz chromium_src-f85d541dfff6b40ede739d3c0c3094ba420bafa2.tar.bz2 |
Initial unit tests implementation.
Review URL: http://codereview.chromium.org/42233
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger/devtools_manager.cc')
-rw-r--r-- | chrome/browser/debugger/devtools_manager.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index 41d0f7a..8a4edf4 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -4,10 +4,8 @@ #include "chrome/browser/debugger/devtools_manager.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/render_view_host_manager.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/notification_registrar.h" @@ -17,8 +15,10 @@ class DevToolsInstanceDescriptorImpl : public DevToolsInstanceDescriptor { public: explicit DevToolsInstanceDescriptorImpl( + DevToolsManager* manager, NavigationController* navigation_controller) - : navigation_controller_(navigation_controller), + : manager_(manager), + navigation_controller_(navigation_controller), devtools_host_(NULL), devtools_window_(NULL) { } @@ -33,11 +33,7 @@ class DevToolsInstanceDescriptorImpl : public DevToolsInstanceDescriptor { } virtual void Destroy() { - DevToolsManager* manager = g_browser_process->devtools_manager(); - DCHECK(manager); - if (manager) { - manager->RemoveDescriptor(this); - } + manager_->RemoveDescriptor(this); delete this; } @@ -54,6 +50,7 @@ class DevToolsInstanceDescriptorImpl : public DevToolsInstanceDescriptor { } private: + DevToolsManager* manager_; NavigationController* navigation_controller_; RenderViewHost* devtools_host_; DevToolsWindow* devtools_window_; @@ -61,7 +58,9 @@ class DevToolsInstanceDescriptorImpl : public DevToolsInstanceDescriptor { DISALLOW_COPY_AND_ASSIGN(DevToolsInstanceDescriptorImpl); }; -DevToolsManager::DevToolsManager() : web_contents_listeners_(NULL) { +DevToolsManager::DevToolsManager(DevToolsWindowFactory* factory) + : web_contents_listeners_(NULL), + devtools_window_factory_(factory) { } DevToolsManager::~DevToolsManager() { @@ -69,6 +68,15 @@ DevToolsManager::~DevToolsManager() { "All devtools windows must alredy have been closed."; } +DevToolsWindow* DevToolsManager::CreateDevToolsWindow( + DevToolsInstanceDescriptor* descriptor) { + if (devtools_window_factory_) { + return devtools_window_factory_->CreateDevToolsWindow(descriptor); + } else { + return DevToolsWindow::Create(descriptor); + } +} + void DevToolsManager::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -100,12 +108,12 @@ void DevToolsManager::ShowDevToolsForWebContents(WebContents* web_contents) { desc = it->second; window = desc->devtools_window(); } else { - desc = new DevToolsInstanceDescriptorImpl(navigation_controller); + desc = new DevToolsInstanceDescriptorImpl(this, navigation_controller); navcontroller_to_descriptor_[navigation_controller] = desc; StartListening(navigation_controller); - window = DevToolsWindow::Create(desc); + window = CreateDevToolsWindow(desc); } window->Show(); |