OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/debugger/debugger_window.h" | 5 #include "chrome/browser/debugger/debugger_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/json_writer.h" | 9 #include "base/json_writer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/common/gfx/chrome_canvas.h" | 23 #include "chrome/common/gfx/chrome_canvas.h" |
24 #include "chrome/common/resource_bundle.h" | 24 #include "chrome/common/resource_bundle.h" |
25 #include "chrome/views/grid_layout.h" | 25 #include "chrome/views/grid_layout.h" |
26 #include "chrome/views/controls/scrollbar/native_scroll_bar.h" | 26 #include "chrome/views/controls/scrollbar/native_scroll_bar.h" |
27 #include "chrome/views/controls/scroll_view.h" | 27 #include "chrome/views/controls/scroll_view.h" |
28 #include "chrome/views/controls/text_field.h" | 28 #include "chrome/views/controls/text_field.h" |
29 #include "chrome/views/view.h" | 29 #include "chrome/views/view.h" |
30 | 30 |
31 #include "grit/debugger_resources.h" | 31 #include "grit/debugger_resources.h" |
32 | 32 |
33 DebuggerView::DebuggerView() : output_ready_(false) { | 33 DebuggerView::DebuggerView(DebuggerWindow* window) |
| 34 : window_(window), output_ready_(false) { |
34 web_container_ = new TabContentsContainerView(); | 35 web_container_ = new TabContentsContainerView(); |
35 AddChildView(web_container_); | 36 AddChildView(web_container_); |
| 37 AddAccelerator(views::Accelerator(VK_ESCAPE, false, false, false)); |
36 } | 38 } |
37 | 39 |
38 DebuggerView::~DebuggerView() { | 40 DebuggerView::~DebuggerView() { |
39 } | 41 } |
40 | 42 |
41 gfx::Size DebuggerView::GetPreferredSize() { | 43 gfx::Size DebuggerView::GetPreferredSize() { |
42 return gfx::Size(700, 400); | 44 return gfx::Size(700, 400); |
43 } | 45 } |
44 | 46 |
45 void DebuggerView::Layout() { | 47 void DebuggerView::Layout() { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 150 |
149 void DebuggerView::ExecuteJavascript(const std::string& js) { | 151 void DebuggerView::ExecuteJavascript(const std::string& js) { |
150 web_contents_->render_view_host()->ExecuteJavascriptInWebFrame(L"", | 152 web_contents_->render_view_host()->ExecuteJavascriptInWebFrame(L"", |
151 UTF8ToWide(js)); | 153 UTF8ToWide(js)); |
152 } | 154 } |
153 | 155 |
154 void DebuggerView::LoadingStateChanged(TabContents* source) { | 156 void DebuggerView::LoadingStateChanged(TabContents* source) { |
155 if (!source->is_loading()) | 157 if (!source->is_loading()) |
156 SetOutputViewReady(); | 158 SetOutputViewReady(); |
157 } | 159 } |
| 160 |
| 161 bool DebuggerView::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 162 DCHECK(accelerator.GetKeyCode() == VK_ESCAPE); |
| 163 window_->window()->Close(); |
| 164 return true; |
| 165 } |
| 166 |
OLD | NEW |