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

Unified Diff: content/browser/devtools/protocol/devtools_protocol_frontend.h

Issue 508973003: DevTools: Protocol handler generator for content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed gn build Created 6 years, 3 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
Index: content/browser/devtools/protocol/devtools_protocol_frontend.h
diff --git a/content/browser/devtools/protocol/devtools_protocol_frontend.h b/content/browser/devtools/protocol/devtools_protocol_frontend.h
new file mode 100644
index 0000000000000000000000000000000000000000..80c62ffa13fa677b4f2e330a5e771cbadfb79cd9
--- /dev/null
+++ b/content/browser/devtools/protocol/devtools_protocol_frontend.h
@@ -0,0 +1,66 @@
+// Copyright 2014 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_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_FRONTEND_H_
+#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_FRONTEND_H_
+
+#include "content/browser/devtools/devtools_protocol.h"
+
+namespace content {
+
+class DevToolsProtocolFrontend {
pfeldman 2014/09/18 10:11:47 DevToolsProtocolClient would fit better.
vkuzkokov 2014/09/19 17:02:45 Done.
+ public:
+ typedef base::Callback<void(const std::string& event,
+ base::DictionaryValue* params)> EventCallback;
+
+ typedef base::Callback<void(scoped_refptr<DevToolsProtocol::Response>)>
+ ResponseCallback;
+
+ enum ResponseStatus {
+ RESPONSE_STATUS_FALLTHROUGH,
+ RESPONSE_STATUS_OK,
+ RESPONSE_STATUS_INVALID_PARAMS,
+ RESPONSE_STATUS_INTERNAL_ERROR,
+ RESPONSE_STATUS_SERVER_ERROR,
+ };
+
+ struct Response {
+ public:
+ static Response FallThrough();
+ static Response OK();
+ static Response InvalidParams(const std::string& message);
+ static Response InternalError(const std::string& message);
+ static Response ServerError(const std::string& message);
+
+ ResponseStatus status() const;
+ const std::string& message() const;
+
+ private:
+ Response();
+
+ ResponseStatus status_;
+ std::string message_;
+ };
+
+ protected:
+ DevToolsProtocolFrontend(const EventCallback& event_callback,
+ const ResponseCallback& response_callback);
+
+ virtual ~DevToolsProtocolFrontend();
+
+ void SendNotification(const std::string& method,
+ base::DictionaryValue* params);
+
+ void SendAsyncResponse(scoped_refptr<DevToolsProtocol::Response> response);
+
+ private:
+ EventCallback event_callback_;
+ ResponseCallback response_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsProtocolFrontend);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_FRONTEND_H_

Powered by Google App Engine
This is Rietveld 408576698