summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsgjesse@chromium.org <sgjesse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-29 18:54:22 +0000
committersgjesse@chromium.org <sgjesse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-29 18:54:22 +0000
commitdd98928411d4dcf3c0371fb86e71fbeaf7b3d3df (patch)
tree51e49ea2a31cc6b13db0ae6cf95dce575031389b /chrome/browser
parentd9f5daca67369220f34029ecdd77e288d46c3596 (diff)
downloadchromium_src-dd98928411d4dcf3c0371fb86e71fbeaf7b3d3df.zip
chromium_src-dd98928411d4dcf3c0371fb86e71fbeaf7b3d3df.tar.gz
chromium_src-dd98928411d4dcf3c0371fb86e71fbeaf7b3d3df.tar.bz2
Stop debugger by escape key.
BUG=6890 Review URL: http://codereview.chromium.org/92116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/debugger/debugger_view.cc11
-rw-r--r--chrome/browser/debugger/debugger_view.h6
-rw-r--r--chrome/browser/debugger/debugger_window.cc2
3 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc
index 0c9f6f8..c292b39 100644
--- a/chrome/browser/debugger/debugger_view.cc
+++ b/chrome/browser/debugger/debugger_view.cc
@@ -30,9 +30,11 @@
#include "grit/debugger_resources.h"
-DebuggerView::DebuggerView() : output_ready_(false) {
+DebuggerView::DebuggerView(DebuggerWindow* window)
+ : window_(window), output_ready_(false) {
web_container_ = new TabContentsContainerView();
AddChildView(web_container_);
+ AddAccelerator(views::Accelerator(VK_ESCAPE, false, false, false));
}
DebuggerView::~DebuggerView() {
@@ -155,3 +157,10 @@ void DebuggerView::LoadingStateChanged(TabContents* source) {
if (!source->is_loading())
SetOutputViewReady();
}
+
+bool DebuggerView::AcceleratorPressed(const views::Accelerator& accelerator) {
+ DCHECK(accelerator.GetKeyCode() == VK_ESCAPE);
+ window_->window()->Close();
+ return true;
+}
+
diff --git a/chrome/browser/debugger/debugger_view.h b/chrome/browser/debugger/debugger_view.h
index 1ebf014..7707713 100644
--- a/chrome/browser/debugger/debugger_view.h
+++ b/chrome/browser/debugger/debugger_view.h
@@ -24,7 +24,7 @@ class WebContents;
class DebuggerView : public views::View,
public TabContentsDelegate {
public:
- DebuggerView();
+ explicit DebuggerView(DebuggerWindow* window);
virtual ~DebuggerView();
// Output a line of text to the debugger view
@@ -81,9 +81,13 @@ class DebuggerView : public views::View,
// Note that this method will take ownership of body.
void SendEventToPage(const std::wstring& name, Value* body);
+ // Handles escape key and close the debug window.
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+
private:
void ExecuteJavascript(const std::string& js);
+ DebuggerWindow* window_;
ChromeFont font_;
WebContents* web_contents_;
TabContentsContainerView* web_container_;
diff --git a/chrome/browser/debugger/debugger_window.cc b/chrome/browser/debugger/debugger_window.cc
index aae04e6..0a58052 100644
--- a/chrome/browser/debugger/debugger_window.cc
+++ b/chrome/browser/debugger/debugger_window.cc
@@ -38,7 +38,7 @@ void DebuggerWindow::Show(TabContents* tab) {
view_->OnShow();
return;
}
- view_ = new DebuggerView();
+ view_ = new DebuggerView(this);
window_ = views::Window::CreateChromeWindow(NULL, gfx::Rect(), this);
window_->Show();
view_->OnShow();