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_
10 #include "base/strings/string_piece.h"
11 #include "content/common/content_export.h"
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
{
23 // Delegate actually handles messages from frontend.
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
,
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_