| Index: content/public/browser/devtools_frontend_host.h
|
| diff --git a/content/public/browser/devtools_frontend_host.h b/content/public/browser/devtools_frontend_host.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..70e3407524448d630c6bf214e6a23e70c979a61f
|
| --- /dev/null
|
| +++ b/content/public/browser/devtools_frontend_host.h
|
| @@ -0,0 +1,57 @@
|
| +// 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_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_
|
| +#define CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "content/common/content_export.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace content {
|
| +
|
| +class WebContents;
|
| +
|
| +// This class dispatches messages between DevTools frontend and Delegate
|
| +// which is implemented by the embedder.
|
| +// This allows us to avoid exposing DevTools frontend messages through
|
| +// the content public API.
|
| +class DevToolsFrontendHost {
|
| + public:
|
| + // Delegate actually handles messages from frontend.
|
| + class Delegate {
|
| + public:
|
| + virtual ~Delegate() {}
|
| +
|
| + // When navigation happens in DevTools frontend WebContents, delegate
|
| + // decides on whether new page is DevTools frontend.
|
| + virtual bool ShouldSetupDevToolsFrontendForUrl(const GURL& url) = 0;
|
| +
|
| + // Message is coming from frontend to the embedder.
|
| + virtual void HandleMessageFromDevToolsFrontend(
|
| + const std::string& message) = 0;
|
| +
|
| + // Message is coming from frontend to the backend.
|
| + // TODO(dgozman): make this to be one of the possible messages to embedder.
|
| + virtual void HandleMessageFromDevToolsFrontendToBackend(
|
| + const std::string& message) = 0;
|
| + };
|
| +
|
| + // Creates a new DevToolsFrontendHost for WebContents where DevTools
|
| + // frontend is loaded.
|
| + CONTENT_EXPORT static DevToolsFrontendHost* Create(
|
| + WebContents* frontend_web_contents, Delegate* delegate);
|
| +
|
| + CONTENT_EXPORT virtual ~DevToolsFrontendHost() {}
|
| +
|
| + // Dispatches message from embedder/backend to frontend.
|
| + // TODO(dgozman): remove and make embedder to take care of this.
|
| + CONTENT_EXPORT virtual void DispatchOnDevToolsFrontend(
|
| + const std::string& message) = 0;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_FRONTEND_HOST_H_
|
|
|