Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / devtools_frontend_host.h
blob05d6ab1836ae7c203d4e048c0166f1aa3415e303
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_
6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_
8 #include <string>
10 #include "base/strings/string_piece.h"
11 #include "content/common/content_export.h"
13 namespace content {
15 class RenderFrameHost;
17 // This class dispatches messages between DevTools frontend and Delegate
18 // which is implemented by the embedder.
19 // This allows us to avoid exposing DevTools frontend messages through
20 // the content public API.
21 class DevToolsFrontendHost {
22 public:
23 // Delegate actually handles messages from frontend.
24 class Delegate {
25 public:
26 virtual ~Delegate() {}
28 // Message is coming from frontend to the embedder.
29 virtual void HandleMessageFromDevToolsFrontend(
30 const std::string& message) = 0;
32 // Message is coming from frontend to the backend.
33 // TODO(dgozman): remove this by making one of the possible messages
34 // passed via the method above.
35 virtual void HandleMessageFromDevToolsFrontendToBackend(
36 const std::string& message) = 0;
39 // Creates a new DevToolsFrontendHost for RenderFrameHost where DevTools
40 // frontend is loaded.
41 CONTENT_EXPORT static DevToolsFrontendHost* Create(
42 RenderFrameHost* frontend_main_frame,
43 Delegate* delegate);
45 CONTENT_EXPORT virtual ~DevToolsFrontendHost() {}
47 CONTENT_EXPORT virtual void BadMessageRecieved() {}
49 // Returns bundled DevTools frontend resource by |path|. Returns empty string
50 // if |path| does not correspond to any frontend resource.
51 CONTENT_EXPORT static base::StringPiece GetFrontendResource(
52 const std::string& path);
55 } // namespace content
57 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_