diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-06 08:30:00 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-06 08:30:00 +0000 |
commit | db6f5f898d9513d94efb1b066e972715e8d38e83 (patch) | |
tree | 488bb6d09b3182ac5ff7de62633bf9626c2f00c8 /chrome | |
parent | 42ef26a5f39bcca7661d0d1ed3571111590a3717 (diff) | |
download | chromium_src-db6f5f898d9513d94efb1b066e972715e8d38e83.zip chromium_src-db6f5f898d9513d94efb1b066e972715e8d38e83.tar.gz chromium_src-db6f5f898d9513d94efb1b066e972715e8d38e83.tar.bz2 |
In process-per-tab mode devtools window may be open for the devtools window using hotkey. This should be useful for development.
Review URL: http://codereview.chromium.org/108028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/debugger/devtools_view.cc | 29 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_view.h | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/debugger/devtools_view.cc b/chrome/browser/debugger/devtools_view.cc index 7a9e59f..3827ef5 100644 --- a/chrome/browser/debugger/devtools_view.cc +++ b/chrome/browser/debugger/devtools_view.cc @@ -6,11 +6,14 @@ #include <string> +#include "base/command_line.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/debugger/devtools_client_host.h" +#include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/tab_contents_container_view.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/property_bag.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" @@ -60,6 +63,32 @@ void DevToolsView::Init() { // this will call CreateRenderView to create renderer process tab_contents_->controller().LoadURL(contents, GURL(), PageTransition::START_PAGE); + + // If each DevTools front end has its own renderer process allow to inspect + // DevTools windows. + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessPerTab)) { + views::Accelerator accelerator('J', true /* shift_down */, + true /* ctrl_down */, false /* alt_down */); + views::FocusManager* focus_manager = GetFocusManager(); + DCHECK(focus_manager); + focus_manager->RegisterAccelerator(accelerator, this); + } +} + +bool DevToolsView::AcceleratorPressed(const views::Accelerator& accelerator) { + // TODO(yurys): get rid of this hack and pull the accelerator from the + // resources + views::Accelerator la('J', true /* shift_down */, true /* ctrl_down */, + false /* alt_down */); + if (!tab_contents_) { + return false; + } + if (!(la == accelerator)) { + return false; + } + DevToolsManager* manager = g_browser_process->devtools_manager(); + manager->OpenDevToolsWindow(tab_contents_); + return true; } void DevToolsView::OnWindowClosing() { diff --git a/chrome/browser/debugger/devtools_view.h b/chrome/browser/debugger/devtools_view.h index 39de03b..aeb9b07 100644 --- a/chrome/browser/debugger/devtools_view.h +++ b/chrome/browser/debugger/devtools_view.h @@ -64,6 +64,7 @@ class DevToolsView : public views::View, virtual void ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child); + virtual bool AcceleratorPressed(const views::Accelerator& accelerator); void Init(); |