Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: components/devtools_service/devtools_agent_host.h

Issue 1164383002: Mandoline DevTools service: remote debugging protocol over HTTP/WebSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/devtools_service/BUILD.gn ('k') | components/devtools_service/devtools_agent_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/devtools_service/devtools_agent_host.h
diff --git a/components/devtools_service/devtools_agent_host.h b/components/devtools_service/devtools_agent_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b5e759fcdf6ec98112ee47821cba3272483185d
--- /dev/null
+++ b/components/devtools_service/devtools_agent_host.h
@@ -0,0 +1,73 @@
+// Copyright 2015 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 COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_AGENT_HOST_H_
+#define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_AGENT_HOST_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/devtools_service/public/interfaces/devtools_service.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
+
+namespace devtools_service {
+
+// DevToolsAgentHost represents a DevTools agent at the service side.
+class DevToolsAgentHost : public DevToolsAgentClient,
+ public mojo::ErrorHandler {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ virtual void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
+ const std::string& message) = 0;
+
+ // Notifies the delegate that |agent_host| is going away.
+ virtual void OnAgentHostClosed(DevToolsAgentHost* agent_host) = 0;
+ };
+
+ explicit DevToolsAgentHost(DevToolsAgentPtr agent);
+
+ ~DevToolsAgentHost() override;
+
+ void set_agent_connection_error_handler(const mojo::Closure& handler) {
+ agent_connection_error_handler_ = handler;
+ }
+
+ std::string id() const { return id_; }
+
+ // Doesn't take ownership of |delegate|. If |delegate| dies before this
+ // object, a new delegate or nullptr must be set so that this object doesn't
+ // hold an invalid pointer.
+ void SetDelegate(Delegate* delegate);
+
+ bool IsAttached() const { return !!delegate_; }
+
+ void SendProtocolMessageToAgent(const std::string& message);
+
+ private:
+ // DevToolsAgentClient implementation.
+ void DispatchProtocolMessage(const mojo::String& message) override;
+
+ // mojo::ErrorHandler implementation.
+ void OnConnectionError() override;
+
+ const std::string id_;
+
+ DevToolsAgentPtr agent_;
+ mojo::Closure agent_connection_error_handler_;
+
+ mojo::Binding<DevToolsAgentClient> binding_;
+
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsAgentHost);
+};
+
+} // namespace devtools_service
+
+#endif // COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_AGENT_HOST_H_
« no previous file with comments | « components/devtools_service/BUILD.gn ('k') | components/devtools_service/devtools_agent_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698