summaryrefslogtreecommitdiffstats
path: root/content/worker/shared_worker_devtools_agent.h
blob: ad6bc7d848910a331ae09ed7a5c30685155005b8 (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) 2012 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_WORKER_SHARED_WORKER_DEVTOOLS_AGENT_H_
#define CONTENT_WORKER_SHARED_WORKER_DEVTOOLS_AGENT_H_

#include <string>

#include "base/basictypes.h"

namespace IPC {
class Message;
}

namespace WebKit {
class WebSharedWorker;
class WebString;
}

namespace content {

class SharedWorkerDevToolsAgent {
 public:
  SharedWorkerDevToolsAgent(int route_id, WebKit::WebSharedWorker*);
  ~SharedWorkerDevToolsAgent();

  // Called on the Worker thread.
  bool OnMessageReceived(const IPC::Message& message);
  void SendDevToolsMessage(const WebKit::WebString&);
  void SaveDevToolsAgentState(const WebKit::WebString& state);

 private:
  void OnAttach();
  void OnReattach(const std::string&);
  void OnDetach();
  void OnDispatchOnInspectorBackend(const std::string& message);
  void OnPauseWorkerContextOnStart();
  void OnResumeWorkerContext();

  bool Send(IPC::Message* message);
  const int route_id_;
  WebKit::WebSharedWorker* webworker_;

  DISALLOW_COPY_AND_ASSIGN(SharedWorkerDevToolsAgent);
};

}  // namespace content

#endif  // CONTENT_WORKER_SHARED_WORKER_DEVTOOLS_AGENT_H_