diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 13:17:12 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 13:17:12 +0000 |
commit | d9f9b79f3dcdf43bdedb0447b0d5c37f411b6f36 (patch) | |
tree | 27e1dcf61d00586b8b6f6d7435d8bb0edba5bb0d /chrome/browser/debugger | |
parent | 936c937ac987d88f2898132a924ef45d329c8af2 (diff) | |
download | chromium_src-d9f9b79f3dcdf43bdedb0447b0d5c37f411b6f36.zip chromium_src-d9f9b79f3dcdf43bdedb0447b0d5c37f411b6f36.tar.gz chromium_src-d9f9b79f3dcdf43bdedb0447b0d5c37f411b6f36.tar.bz2 |
DevTools: remove ShowJavaScriptConsole / InspectElementAt methods from render_view_host API.
Review URL: http://codereview.chromium.org/146080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger')
-rw-r--r-- | chrome/browser/debugger/debugger_remote_service.cc | 6 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_manager.cc | 18 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_manager.h | 3 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_sanity_unittest.cc | 5 |
4 files changed, 24 insertions, 8 deletions
diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index 47f503e3..9a46c63 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -229,7 +229,7 @@ void DebuggerRemoteService::AttachToTab(const std::string& destination, if (client_host == NULL) { client_host = delegate_->inspectable_tab_proxy()->NewClientHost(tab_uid, this); - DevToolsManager* manager = g_browser_process->devtools_manager(); + DevToolsManager* manager = DevToolsManager::GetInstance(); if (manager != NULL) { manager->RegisterDevToolsClientHostFor(target_host, client_host); response->SetInteger(kResultWide, RESULT_OK); @@ -283,7 +283,7 @@ bool DebuggerRemoteService::DispatchDebuggerCommand(int tab_uid, response->SetInteger(kResultWide, RESULT_UNKNOWN_TAB); return true; } - DevToolsManager* manager = g_browser_process->devtools_manager(); + DevToolsManager* manager = DevToolsManager::GetInstance(); if (manager == NULL) { response->SetInteger(kResultWide, RESULT_DEBUGGER_ERROR); return true; @@ -305,7 +305,7 @@ bool DebuggerRemoteService::DispatchDebuggerCommand(int tab_uid, DictionaryValue* v8_command_value; content->GetDictionary(kDataWide, &v8_command_value); JSONWriter::Write(v8_command_value, false, &v8_command); - g_browser_process->devtools_manager()->ForwardToDevToolsAgent( + manager->ForwardToDevToolsAgent( client_host, DevToolsAgentMsg_DebuggerCommand(v8_command)); // Do not send the response right now, as the JSON will be received from // the V8 debugger asynchronously. diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index 5e5907f..f6dcc7b 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -5,6 +5,7 @@ #include "chrome/browser/debugger/devtools_manager.h" #include "base/message_loop.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/profile.h" @@ -15,8 +16,14 @@ #include "chrome/common/pref_service.h" #include "googleurl/src/gurl.h" +// static +DevToolsManager* DevToolsManager::GetInstance() { + return g_browser_process->devtools_manager(); +} + DevToolsManager::DevToolsManager() - : inspected_rvh_for_reopen_(NULL) { + : inspected_rvh_for_reopen_(NULL), + in_initial_show_(false) { } DevToolsManager::~DevToolsManager() { @@ -97,8 +104,11 @@ void DevToolsManager::OpenDevToolsWindow(RenderViewHost* inspected_rvh) { RegisterDevToolsClientHostFor(inspected_rvh, host); } DevToolsWindow* window = host->AsDevToolsWindow(); - if (window) + if (window) { + in_initial_show_ = true; window->Show(); + in_initial_show_ = false; + } } void DevToolsManager::InspectElement(RenderViewHost* inspected_rvh, @@ -148,6 +158,10 @@ void DevToolsManager::UnregisterDevToolsClientHostFor( void DevToolsManager::OnNavigatingToPendingEntry(RenderViewHost* rvh, RenderViewHost* dest_rvh, const GURL& gurl) { + if (in_initial_show_) { + // Mute this even in case it is caused by the initial show routines. + return; + } DevToolsClientHost* client_host = GetDevToolsClientHostFor(rvh); if (client_host) { diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h index d911250..3790d27 100644 --- a/chrome/browser/debugger/devtools_manager.h +++ b/chrome/browser/debugger/devtools_manager.h @@ -22,6 +22,8 @@ class RenderViewHost; class DevToolsManager : public DevToolsClientHost::CloseListener, public base::RefCounted<DevToolsManager> { public: + static DevToolsManager* GetInstance(); + DevToolsManager(); virtual ~DevToolsManager(); @@ -87,6 +89,7 @@ private: ClientHostToInspectedRvhMap; ClientHostToInspectedRvhMap client_host_to_inspected_rvh_; RenderViewHost* inspected_rvh_for_reopen_; + bool in_initial_show_; DISALLOW_COPY_AND_ASSIGN(DevToolsManager); }; diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index d52d9cd..8e7deb5 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -4,7 +4,6 @@ #include "base/command_line.h" #include "chrome/browser/browser.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/debugger/devtools_window.h" @@ -72,7 +71,7 @@ class DevToolsSanityTest : public InProcessBrowserTest { TabContents* tab = browser()->GetTabContentsAt(0); inspected_rvh_ = tab->render_view_host(); - DevToolsManager* devtools_manager = g_browser_process->devtools_manager(); + DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); devtools_manager->OpenDevToolsWindow(inspected_rvh_); DevToolsClientHost* client_host = @@ -84,7 +83,7 @@ class DevToolsSanityTest : public InProcessBrowserTest { } void CloseDevToolsWindow() { - DevToolsManager* devtools_manager = g_browser_process->devtools_manager(); + DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); devtools_manager->UnregisterDevToolsClientHostFor(inspected_rvh_); BrowserClosedObserver close_observer(window_->browser()); } |