summaryrefslogtreecommitdiffstats
path: root/chrome/browser/debugger/debugger_wrapper.cc
blob: c55184628be08e61b55ff4a9e2ad9fbc2033def7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/debugger/debugger_wrapper.h"

#include "chrome/browser/debugger/debugger_remote_service.h"
#include "chrome/browser/debugger/devtools_protocol_handler.h"
#include "chrome/browser/debugger/devtools_remote_service.h"
#include "chrome/browser/debugger/extension_ports_remote_service.h"

DebuggerWrapper::DebuggerWrapper(int port) {
  if (port > 0) {
    proto_handler_ = new DevToolsProtocolHandler(port);
    proto_handler_->RegisterDestination(
        new DevToolsRemoteService(proto_handler_),
        DevToolsRemoteService::kToolName);
    proto_handler_->RegisterDestination(
        new DebuggerRemoteService(proto_handler_),
        DebuggerRemoteService::kToolName);
    proto_handler_->RegisterDestination(
        new ExtensionPortsRemoteService(proto_handler_),
        ExtensionPortsRemoteService::kToolName);
    proto_handler_->Start();
  }
}

DebuggerWrapper::~DebuggerWrapper() {
  if (proto_handler_.get() != NULL) {
    proto_handler_->Stop();
  }
}