summaryrefslogtreecommitdiffstats
path: root/content/renderer/devtools/devtools_client.h
blob: 6460ca83c7303a72f192bef56df5cda2281079f6 (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
51
52
// 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_RENDERER_DEVTOOLS_DEVTOOLS_CLIENT_H_
#define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_CLIENT_H_

#include <string>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/web/WebDevToolsFrontendClient.h"

namespace blink {
class WebDevToolsFrontend;
class WebString;
}

namespace content {

// Developer tools UI end of communication channel between the render process of
// the page being inspected and tools UI renderer process. All messages will
// go through browser process. On the side of the inspected page there's
// corresponding DevToolsAgent object.
// TODO(yurys): now the client is almost empty later it will delegate calls to
// code in glue
class CONTENT_EXPORT DevToolsClient
    : public RenderFrameObserver,
      NON_EXPORTED_BASE(public blink::WebDevToolsFrontendClient) {
 public:
  explicit DevToolsClient(RenderFrame* main_render_frame);
  virtual ~DevToolsClient();

 private:
  // WebDevToolsFrontendClient implementation.
  virtual void sendMessageToBackend(const blink::WebString&) override;
  virtual void sendMessageToEmbedder(const blink::WebString&) override;

  virtual bool isUnderTest() override;

  void OnDispatchOnInspectorFrontend(const std::string& message,
                                     uint32 total_size);

  scoped_ptr<blink::WebDevToolsFrontend> web_tools_frontend_;

  DISALLOW_COPY_AND_ASSIGN(DevToolsClient);
};

}  // namespace content

#endif  // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_CLIENT_H_