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 // Simple UI for the command-line V8 debugger consisting of a text field for | 5 // Simple UI for the command-line V8 debugger consisting of a text field for |
6 // entry and an output view consisting of (potentially wrapped) lines of text. | 6 // entry and an output view consisting of (potentially wrapped) lines of text. |
7 | 7 |
8 // TODO(erikkay): investigate replacing this with a DHTML interface | 8 // TODO(erikkay): investigate replacing this with a DHTML interface |
9 | 9 |
10 #ifndef CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ | 10 #ifndef CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ |
11 #define CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ | 11 #define CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ |
12 | 12 |
13 #include "base/gfx/size.h" | 13 #include "base/gfx/size.h" |
14 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 14 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
15 #include "chrome/views/view.h" | 15 #include "chrome/views/view.h" |
16 #include "chrome/views/controls/text_field.h" | 16 #include "chrome/views/controls/text_field.h" |
17 | 17 |
18 class DebuggerView; | 18 class DebuggerView; |
19 class DebuggerWindow; | 19 class DebuggerWindow; |
20 class TabContentsContainerView; | 20 class TabContentsContainerView; |
21 class Value; | 21 class Value; |
22 class WebContents; | 22 class WebContents; |
23 | 23 |
24 class DebuggerView : public views::View, | 24 class DebuggerView : public views::View, |
25 public TabContentsDelegate { | 25 public TabContentsDelegate { |
26 public: | 26 public: |
27 DebuggerView(); | 27 explicit DebuggerView(DebuggerWindow* window); |
28 virtual ~DebuggerView(); | 28 virtual ~DebuggerView(); |
29 | 29 |
30 // Output a line of text to the debugger view | 30 // Output a line of text to the debugger view |
31 void Output(const std::string& out); | 31 void Output(const std::string& out); |
32 void Output(const std::wstring& out); | 32 void Output(const std::wstring& out); |
33 | 33 |
34 void OnInit(); | 34 void OnInit(); |
35 | 35 |
36 // Called when the window is shown. | 36 // Called when the window is shown. |
37 void OnShow(); | 37 void OnShow(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual bool IsPopup(TabContents* source) { return false; } | 74 virtual bool IsPopup(TabContents* source) { return false; } |
75 virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {} | 75 virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {} |
76 virtual void URLStarredChanged(TabContents* source, bool) {} | 76 virtual void URLStarredChanged(TabContents* source, bool) {} |
77 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} | 77 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} |
78 virtual bool CanBlur() const { return false; } | 78 virtual bool CanBlur() const { return false; } |
79 | 79 |
80 // To pass messages from DebuggerHost to debugger UI. | 80 // To pass messages from DebuggerHost to debugger UI. |
81 // Note that this method will take ownership of body. | 81 // Note that this method will take ownership of body. |
82 void SendEventToPage(const std::wstring& name, Value* body); | 82 void SendEventToPage(const std::wstring& name, Value* body); |
83 | 83 |
| 84 // Handles escape key and close the debug window. |
| 85 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
| 86 |
84 private: | 87 private: |
85 void ExecuteJavascript(const std::string& js); | 88 void ExecuteJavascript(const std::string& js); |
86 | 89 |
| 90 DebuggerWindow* window_; |
87 ChromeFont font_; | 91 ChromeFont font_; |
88 WebContents* web_contents_; | 92 WebContents* web_contents_; |
89 TabContentsContainerView* web_container_; | 93 TabContentsContainerView* web_container_; |
90 std::vector<std::wstring> pending_output_; | 94 std::vector<std::wstring> pending_output_; |
91 std::vector<std::string> pending_events_; | 95 std::vector<std::string> pending_events_; |
92 bool output_ready_; | 96 bool output_ready_; |
93 | 97 |
94 DISALLOW_EVIL_CONSTRUCTORS(DebuggerView); | 98 DISALLOW_EVIL_CONSTRUCTORS(DebuggerView); |
95 }; | 99 }; |
96 | 100 |
97 | 101 |
98 #endif // CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ | 102 #endif // CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ |
OLD | NEW |