summaryrefslogtreecommitdiffstats
path: root/chrome/browser/debugger/debugger_shell.cc
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 16:25:09 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 16:25:09 +0000
commit5ced5eb46be9e6c2d2b72a421d930cee6d7fcf89 (patch)
treeffccdfbb0ccd8a7f2663d0144e7684c8ffee0194 /chrome/browser/debugger/debugger_shell.cc
parentf18953d3c2a4eae2bc33b1eecce96e28f0815a64 (diff)
downloadchromium_src-5ced5eb46be9e6c2d2b72a421d930cee6d7fcf89.zip
chromium_src-5ced5eb46be9e6c2d2b72a421d930cee6d7fcf89.tar.gz
chromium_src-5ced5eb46be9e6c2d2b72a421d930cee6d7fcf89.tar.bz2
Initial cleanup and refactoring to make debugger UI use DHTML and get rid of the last of its native UI. This is done using a DOMUIHost subclass and a new TabContents type.
This checkin also fixes a few minor issues: * hitting the keyboard accelerator brings the current debugger window to front * text is grayed out when in "running" mode rather than "paused" * up/down arrows have command-line history (transient) * some text used to get eaten when you first bring up the window ("attached to <tabname>"), this is now handled git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger/debugger_shell.cc')
-rw-r--r--chrome/browser/debugger/debugger_shell.cc44
1 files changed, 29 insertions, 15 deletions
diff --git a/chrome/browser/debugger/debugger_shell.cc b/chrome/browser/debugger/debugger_shell.cc
index 0679292..9f47258 100644
--- a/chrome/browser/debugger/debugger_shell.cc
+++ b/chrome/browser/debugger/debugger_shell.cc
@@ -36,14 +36,13 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/browser_resources.h"
-#include "chrome/browser/render_process_host.h"
-#include "chrome/browser/tab_contents.h"
#include "chrome/browser/debugger/debugger_io.h"
#include "chrome/browser/debugger/debugger_node.h"
+#include "chrome/browser/debugger/resources/debugger_resources.h"
+#include "chrome/browser/render_process_host.h"
+#include "chrome/browser/tab_contents.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/resource_bundle.h"
-#include "v8/public/v8.h"
DebuggerShell::DebuggerShell(DebuggerInputOutput* io) : io_(io),
debugger_ready_(true) {
@@ -148,11 +147,11 @@ v8::Handle<v8::Value> DebuggerShell::Subshell(const v8::Arguments& args) {
v8::Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(args[0]);
v8::Local<v8::Object> obj = func->NewInstance();
if (!obj->IsUndefined()) {
- shell_= v8::Persistent<v8::Object>::New(obj);
+ shell_ = v8::Persistent<v8::Object>::New(obj);
v8_context_->Global()->Set(v8::String::New("shell_"), shell_);
}
} else if (args[0]->IsObject()) {
- shell_= v8::Persistent<v8::Object>::New(v8::Local<v8::Object>::Cast(args[0]));
+ shell_ = v8::Persistent<v8::Object>::New(v8::Local<v8::Object>::Cast(args[0]));
v8_context_->Global()->Set(v8::String::New("shell_"), shell_);
}
return v8::Undefined();
@@ -346,20 +345,22 @@ void DebuggerShell::PrintPrompt() {
io_->OutputPrompt(out);
}
-void DebuggerShell::ProcessCommand(const std::string& data) {
+void DebuggerShell::ProcessCommand(const std::wstring& data) {
v8::HandleScope outer;
v8::Context::Scope scope(v8_context_);
- if (!shell_.IsEmpty() && data.substr(0, 7) != "source(") {
- if (data == "exit") {
+ if (!shell_.IsEmpty() && data.substr(0, 7) != L"source(") {
+ if (data == L"exit") {
PrintObject(SubshellFunction("exit", 0, NULL));
v8_context_->Global()->Delete(v8::String::New("shell_"));
shell_.Dispose();
shell_.Clear();
} else {
- v8::Handle<v8::Value> argv[] = {v8::String::New(data.c_str())};
+ const uint16* utf16 = reinterpret_cast<const uint16*>(data.c_str());
+ v8::Handle<v8::Value> argv[] = {v8::String::New(utf16)};
PrintObject(SubshellFunction("command", 1, argv));
}
} else if (data.length()) {
+ //TODO(erikkay): change everything to wstring
v8::Handle<v8::Value> result = CompileAndRun(data);
PrintObject(result);
}
@@ -394,8 +395,21 @@ void DebuggerShell::DidConnect() {
PrintPrompt();
}
-v8::Handle<v8::Value> DebuggerShell::CompileAndRun(const std::string& str,
- const std::string& filename) {
+void DebuggerShell::DidDisconnect() {
+ v8::HandleScope outer;
+ SubshellFunction("exit", 0, NULL);
+}
+
+v8::Handle<v8::Value> DebuggerShell::CompileAndRun(
+ const std::string& str,
+ const std::string& filename) {
+ const std::wstring wstr = UTF8ToWide(str);
+ return CompileAndRun(wstr, filename);
+}
+
+v8::Handle<v8::Value> DebuggerShell::CompileAndRun(
+ const std::wstring& wstr,
+ const std::string& filename) {
v8::Context::Scope scope(v8_context_);
v8::Handle<v8::String> scriptname;
if (filename.length() > 0) {
@@ -403,10 +417,10 @@ v8::Handle<v8::Value> DebuggerShell::CompileAndRun(const std::string& str,
} else {
scriptname = v8::String::New("");
}
- v8::ScriptOrigin origin =
- v8::ScriptOrigin(scriptname);
+ const uint16* utf16 = reinterpret_cast<const uint16*>(wstr.c_str());
+ v8::ScriptOrigin origin = v8::ScriptOrigin(scriptname);
v8::Local<v8::Script> code =
- v8::Script::Compile(v8::String::New(str.c_str()), &origin);
+ v8::Script::Compile(v8::String::New(utf16), &origin);
if (!code.IsEmpty()) {
v8::Local<v8::Value> result = code->Run();
if (!result.IsEmpty()) {