diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 13:55:01 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 13:55:01 +0000 |
commit | 59af1de9315f81a415ac87d952a49baab7cc2438 (patch) | |
tree | 784344805ee460be1271688fe14c79333c7da22e /chrome/browser/debugger/devtools_window.cc | |
parent | 00b27811ce7cc1dfd8c4bb1b5669354f871f43e0 (diff) | |
download | chromium_src-59af1de9315f81a415ac87d952a49baab7cc2438.zip chromium_src-59af1de9315f81a415ac87d952a49baab7cc2438.tar.gz chromium_src-59af1de9315f81a415ac87d952a49baab7cc2438.tar.bz2 |
DevTools: Wire Ctrl+Shift+C to "Show JavaScript console".
Review URL: http://codereview.chromium.org/377005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger/devtools_window.cc')
-rw-r--r-- | chrome/browser/debugger/devtools_window.cc | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 75fb4fe..e5fe7be 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -49,7 +49,9 @@ DevToolsWindow::DevToolsWindow(Profile* profile, : profile_(profile), browser_(NULL), inspected_window_(NULL), - docked_(docked) { + docked_(docked), + is_loaded_(false), + open_console_on_load_(false) { // Create TabContents with devtools. tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL); GURL url(std::string(chrome::kChromeUIDevToolsURL) + "devtools.html"); @@ -104,7 +106,7 @@ void DevToolsWindow::InspectedTabClosing() { } } -void DevToolsWindow::Show() { +void DevToolsWindow::Show(bool open_console) { if (docked_) { // Just tell inspected browser to update splitter. inspected_window_ = GetInspectedBrowserWindow(); @@ -119,11 +121,18 @@ void DevToolsWindow::Show() { } } - if (!browser_) { + if (!browser_) CreateDevToolsBrowser(); - } + browser_->window()->Show(); tab_contents_->view()->SetInitialFocus(); + + if (open_console) { + if (is_loaded_) + OpenConsole(); + else + open_console_on_load_ = true; + } } void DevToolsWindow::Activate() { @@ -154,7 +163,7 @@ void DevToolsWindow::SetDocked(bool docked) { inspected_window_->UpdateDevTools(); inspected_window_ = NULL; } - Show(); + Show(false); } RenderViewHost* DevToolsWindow::GetRenderViewHost() { @@ -211,6 +220,9 @@ void DevToolsWindow::Observe(NotificationType type, ExecuteJavascriptInWebFrame( L"", docked_ ? L"WebInspector.setAttachedWindow(true);" : L"WebInspector.setAttachedWindow(false);"); + is_loaded_ = true; + if (open_console_on_load_) + OpenConsole(); } else if (type == NotificationType::TAB_CLOSING) { if (Source<NavigationController>(source).ptr() == &tab_contents_->controller()) { @@ -223,3 +235,8 @@ void DevToolsWindow::Observe(NotificationType type, } } } + +void DevToolsWindow::OpenConsole() { + tab_contents_->render_view_host()-> + ExecuteJavascriptInWebFrame(L"", L"WebInspector.showConsole();"); +} |