summaryrefslogtreecommitdiffstats
path: root/content/renderer/devtools/devtools_client.h
blob: 768253d18516efe1b85e8d38821dccb4d7c5ee53 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// 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_view_observer.h"
#include "third_party/WebKit/public/web/WebDevToolsFrontendClient.h"

namespace WebKit {
class WebDevToolsFrontend;
class WebString;
}

namespace content {

class RenderViewImpl;

// 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 RenderViewObserver,
    NON_EXPORTED_BASE(public WebKit::WebDevToolsFrontendClient) {
 public:
  explicit DevToolsClient(RenderViewImpl* render_view);
  virtual ~DevToolsClient();

 private:
  // RenderView::Observer implementation.
  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;

  // WebDevToolsFrontendClient implementation.
  virtual void sendMessageToBackend(const WebKit::WebString&) OVERRIDE;

  virtual void activateWindow() OVERRIDE;
  virtual void changeAttachedWindowHeight(unsigned height) OVERRIDE;
  virtual void closeWindow() OVERRIDE;
  virtual void moveWindowBy(const WebKit::WebFloatPoint& offset) OVERRIDE;
  virtual void requestSetDockSide(const WebKit::WebString& side) OVERRIDE;
  virtual void openInNewTab(const WebKit::WebString& side) OVERRIDE;
  virtual void save(const WebKit::WebString& url,
                    const WebKit::WebString& content,
                    bool save_as) OVERRIDE;
  virtual void append(const WebKit::WebString& url,
                      const WebKit::WebString& content) OVERRIDE;

  virtual void requestFileSystems() OVERRIDE;
  virtual void addFileSystem() OVERRIDE;
  virtual void removeFileSystem(
      const WebKit::WebString& file_system_path) OVERRIDE;
  virtual void indexPath(int request_id,
                         const WebKit::WebString& file_system_path) OVERRIDE;
  virtual void stopIndexing(int request_id) OVERRIDE;
  virtual void searchInPath(int request_id,
                            const WebKit::WebString& file_system_path,
                            const WebKit::WebString& query) OVERRIDE;

  virtual bool isUnderTest() OVERRIDE;

  void OnDispatchOnInspectorFrontend(const std::string& message);

  scoped_ptr<WebKit::WebDevToolsFrontend> web_tools_frontend_;

  DISALLOW_COPY_AND_ASSIGN(DevToolsClient);
};

}  // namespace content

#endif  // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_CLIENT_H_