OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 class RenderFrameHost; | 16 class WebContents; |
17 | 17 |
18 // This class dispatches messages between DevTools frontend and Delegate | 18 // This class dispatches messages between DevTools frontend and Delegate |
19 // which is implemented by the embedder. | 19 // which is implemented by the embedder. |
20 // This allows us to avoid exposing DevTools frontend messages through | 20 // This allows us to avoid exposing DevTools frontend messages through |
21 // the content public API. | 21 // the content public API. |
22 class DevToolsFrontendHost { | 22 class DevToolsFrontendHost { |
23 public: | 23 public: |
24 using HandleMessageCallback = base::Callback<void(const std::string&)>; | 24 using HandleMessageCallback = base::Callback<void(const std::string&)>; |
25 | 25 |
26 // Creates a new DevToolsFrontendHost for RenderFrameHost where DevTools | 26 // Creates a new DevToolsFrontendHost for RenderFrameHost where DevTools |
27 // frontend is loaded. | 27 // frontend is loaded. |
28 CONTENT_EXPORT static DevToolsFrontendHost* Create( | 28 CONTENT_EXPORT static DevToolsFrontendHost* Create( |
29 RenderFrameHost* frontend_main_frame, | 29 WebContents* web_contents, |
30 const HandleMessageCallback& handle_message_callback); | 30 const HandleMessageCallback& handle_message_callback); |
31 | 31 |
32 CONTENT_EXPORT virtual ~DevToolsFrontendHost() {} | 32 CONTENT_EXPORT virtual ~DevToolsFrontendHost() {} |
33 | 33 |
34 CONTENT_EXPORT virtual void BadMessageRecieved() {} | 34 CONTENT_EXPORT virtual void BadMessageRecieved() {} |
35 | 35 |
36 // Returns bundled DevTools frontend resource by |path|. Returns empty string | 36 // Returns bundled DevTools frontend resource by |path|. Returns empty string |
37 // if |path| does not correspond to any frontend resource. | 37 // if |path| does not correspond to any frontend resource. |
38 CONTENT_EXPORT static base::StringPiece GetFrontendResource( | 38 CONTENT_EXPORT static base::StringPiece GetFrontendResource( |
39 const std::string& path); | 39 const std::string& path); |
40 }; | 40 }; |
41 | 41 |
42 } // namespace content | 42 } // namespace content |
43 | 43 |
44 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ | 44 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ |
OLD | NEW |