| 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_host_impl.h" | 5 #include "chrome/browser/debugger/debugger_host_impl.h" |
| 6 | 6 |
| 7 #include "base/json_reader.h" | 7 #include "base/json_reader.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/debugger/debugger_io.h" | 10 #include "chrome/browser/debugger/debugger_io.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 NavigationController* navigation_controller_; | 61 NavigationController* navigation_controller_; |
| 62 bool observing_; | 62 bool observing_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(TabContentsReference); | 64 DISALLOW_COPY_AND_ASSIGN(TabContentsReference); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 | 67 |
| 68 DebuggerHostImpl::DebuggerHostImpl(DebuggerInputOutput* io) | 68 DebuggerHostImpl::DebuggerHostImpl(DebuggerInputOutput* io) |
| 69 : io_(io), | 69 : io_(io), |
| 70 debugger_ready_(true) { | 70 debugger_ready_(true) { |
| 71 } | 71 } |
| 72 | 72 |
| 73 DebuggerHostImpl::~DebuggerHostImpl() { | 73 DebuggerHostImpl::~DebuggerHostImpl() { |
| 74 io_->Stop(); | 74 io_->Stop(); |
| 75 io_ = NULL; | 75 io_ = NULL; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DebuggerHostImpl::Start() { | 78 void DebuggerHostImpl::Start() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 } | 91 } |
| 92 ListValue* argv = new ListValue; | 92 ListValue* argv = new ListValue; |
| 93 argv->Append(msg_value); | 93 argv->Append(msg_value); |
| 94 io_->CallFunctionInPage(L"response", argv); | 94 io_->CallFunctionInPage(L"response", argv); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void DebuggerHostImpl::OnDebugAttach() { | 97 void DebuggerHostImpl::OnDebugAttach() { |
| 98 std::wstring title; | 98 std::wstring title; |
| 99 const TabContents* t = GetTabContentsBeingDebugged(); | 99 const TabContents* t = GetTabContentsBeingDebugged(); |
| 100 if (t) { | 100 if (t) { |
| 101 title = t->GetTitle(); | 101 title = UTF16ToWideHack(t->GetTitle()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 ListValue* argv = new ListValue; | 104 ListValue* argv = new ListValue; |
| 105 argv->Append(Value::CreateStringValue(title)); | 105 argv->Append(Value::CreateStringValue(title)); |
| 106 io_->CallFunctionInPage(L"on_attach", argv); | 106 io_->CallFunctionInPage(L"on_attach", argv); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void DebuggerHostImpl::OnDebugDisconnect() { | 109 void DebuggerHostImpl::OnDebugDisconnect() { |
| 110 ListValue* argv = new ListValue; | 110 ListValue* argv = new ListValue; |
| 111 io_->CallFunctionInPage(L"on_disconnect", argv); | 111 io_->CallFunctionInPage(L"on_disconnect", argv); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 io_->SetDebuggerReady(ready == L"true"); | 172 io_->SetDebuggerReady(ready == L"true"); |
| 173 } else if (methodName == L"setDebuggerBreak") { | 173 } else if (methodName == L"setDebuggerBreak") { |
| 174 std::wstring brk; | 174 std::wstring brk; |
| 175 Value* value = NULL; | 175 Value* value = NULL; |
| 176 if (!args->Get(1, &value) || !value->GetAsString(&brk)) { | 176 if (!args->Get(1, &value) || !value->GetAsString(&brk)) { |
| 177 NOTREACHED(); | 177 NOTREACHED(); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 io_->SetDebuggerBreak(brk == L"true"); | 180 io_->SetDebuggerBreak(brk == L"true"); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 TabContents* DebuggerHostImpl::GetTabContentsBeingDebugged() const { | 184 TabContents* DebuggerHostImpl::GetTabContentsBeingDebugged() const { |
| 185 if (tab_reference_ != NULL) { | 185 if (tab_reference_ != NULL) { |
| 186 return tab_reference_->GetTabContents(); | 186 return tab_reference_->GetTabContents(); |
| 187 } else { | 187 } else { |
| 188 return NULL; | 188 return NULL; |
| 189 } | 189 } |
| 190 } | 190 } |
| OLD | NEW |