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

Unified Diff: ui/devtools/devtools_client.h

Issue 2374513002: Add ui devtools server (Closed)
Patch Set: Add comments Created 4 years, 2 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 | « ui/devtools/DEPS ('k') | ui/devtools/devtools_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/devtools/devtools_client.h
diff --git a/ui/devtools/devtools_client.h b/ui/devtools/devtools_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..5fa875dca756325d30219ca6cc40af0395437d96
--- /dev/null
+++ b/ui/devtools/devtools_client.h
@@ -0,0 +1,57 @@
+// Copyright 2016 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 UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
+#define UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
+
+#include <string>
+
+#include "ui/devtools/DOM.h"
+#include "ui/devtools/Forward.h"
+#include "ui/devtools/Protocol.h"
+#include "ui/devtools/string_util.h"
+
+namespace ui {
+namespace devtools {
+
+class UiDevToolsServer;
+
+// Every UI component that wants to be inspectable must instantiate
+// this class and attach the corresponding backends/frontends (i.e: DOM, CSS,
+// etc). This client is then attached to the UiDevToolsServer and all messages
+// from this client are sent over the web socket owned by the server.
+class UiDevToolsClient : public protocol::FrontendChannel {
+ public:
+ static const int kNotConnected = -1;
+
+ UiDevToolsClient(const String& name, UiDevToolsServer* server);
sadrul 2016/10/18 20:29:37 Let's use const std::string& here. (you probably d
Sarmad Hashmi 2016/10/19 23:56:02 Done.
+ ~UiDevToolsClient() override;
+
+ void AddDOMBackend(std::unique_ptr<protocol::DOM::Backend> dom_backend);
+ void Dispatch(const String& data);
+
+ bool connected() const;
+ void set_connection_id(int connection_id);
+ std::string name() const;
sadrul 2016/10/18 20:29:37 return a const-ref as well, i.e.: const std::str
Sarmad Hashmi 2016/10/19 23:56:02 Done.
+
+ private:
+ // protocol::FrontendChannel
+ void sendProtocolResponse(int callId, const String& message) override;
+ void sendProtocolNotification(const String& message) override;
+ void flushProtocolNotifications() override;
+
+ std::string name_;
+ int connection_id_;
+
+ std::unique_ptr<protocol::DOM::Backend> dom_backend_;
+ protocol::UberDispatcher dispatcher_;
+ UiDevToolsServer* server_;
+
+ DISALLOW_COPY_AND_ASSIGN(UiDevToolsClient);
+};
+
+} // namespace devtools
+} // namespace ui
+
+#endif // UI_DEVTOOLS_DEVTOOLS_CLIENT_H_
« no previous file with comments | « ui/devtools/DEPS ('k') | ui/devtools/devtools_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698