OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "content/common/content_export.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class WebContents; |
| 16 |
| 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() {} |
| 27 |
| 28 // When navigation happens in DevTools frontend WebContents, delegate |
| 29 // decides on whether new page is DevTools frontend. |
| 30 virtual bool ShouldSetupDevToolsFrontendForUrl(const GURL& url) = 0; |
| 31 |
| 32 // Message is coming from frontend to the embedder. |
| 33 virtual void HandleMessageFromDevToolsFrontend( |
| 34 const std::string& message) = 0; |
| 35 |
| 36 // Message is coming from frontend to the backend. |
| 37 // TODO(dgozman): make this to be one of the possible messages to embedder. |
| 38 virtual void HandleMessageFromDevToolsFrontendToBackend( |
| 39 const std::string& message) = 0; |
| 40 }; |
| 41 |
| 42 // Creates a new DevToolsFrontendHost for WebContents where DevTools |
| 43 // frontend is loaded. |
| 44 CONTENT_EXPORT static DevToolsFrontendHost* Create( |
| 45 WebContents* frontend_web_contents, Delegate* delegate); |
| 46 |
| 47 CONTENT_EXPORT virtual ~DevToolsFrontendHost() {} |
| 48 |
| 49 // Dispatches message from embedder/backend to frontend. |
| 50 // TODO(dgozman): remove and make embedder to take care of this. |
| 51 CONTENT_EXPORT virtual void DispatchOnDevToolsFrontend( |
| 52 const std::string& message) = 0; |
| 53 }; |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_ |
OLD | NEW |