summaryrefslogtreecommitdiffstats
path: root/content/renderer/worker_devtools_agent_proxy.h
blob: 99ae1f2b109e085ea977df354955cc5e6c9ab41e (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2011 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.

#ifndef CONTENT_RENDERER_WORKER_DEVTOOLS_AGENT_PROXY_H_
#define CONTENT_RENDERER_WORKER_DEVTOOLS_AGENT_PROXY_H_
#pragma once

#include <string>

#include "base/basictypes.h"

namespace IPC {
class Message;
}

namespace WebKit {
class WebWorkerClient;
}

class WebWorkerBase;

class WorkerDevToolsAgentProxy {
 public:
  WorkerDevToolsAgentProxy(WebWorkerBase*,
                           int route_id,
                           WebKit::WebWorkerClient*);
  ~WorkerDevToolsAgentProxy();

  void WorkerProxyDestroyed();
  void SetRouteId(int route_id);
  bool OnMessageReceived(const IPC::Message& message);

  void AttachDevTools();
  void DetachDevTools();
  void SendDevToolsMessage(const std::string&);

 private:
  void OnDispatchMessageFromWorker(const std::string& message);

  void Send(IPC::Message* message);

  int route_id_;
  WebWorkerBase* webworker_;
  WebKit::WebWorkerClient* webworker_client_;

  DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsAgentProxy);
};

#endif  // CONTENT_RENDERER_WORKER_DEVTOOLS_AGENT_PROXY_H_