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

Unified Diff: content/browser/debugger/devtools_browser_target.h

Issue 11548032: Telemetry / Devtools TraceHandler: exposes tracing via dev tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More comments Created 8 years 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/debugger/devtools_browser_target.h
diff --git a/content/browser/debugger/devtools_browser_target.h b/content/browser/debugger/devtools_browser_target.h
new file mode 100644
index 0000000000000000000000000000000000000000..55dc2b6c65739330dd07d8fb11d39fde22db3cca
--- /dev/null
+++ b/content/browser/debugger/devtools_browser_target.h
@@ -0,0 +1,60 @@
+// 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_BROWSER_DEBUGGER_DEVTOOLS_BROWSER_TARGET_H_
+#define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_BROWSER_TARGET_H_
+
+#include <map>
+#include <string>
+
+#include "base/basictypes.h"
+
+namespace base {
+
+class DictionaryValue;
+class Value;
+
+} // namespace base
+
+namespace content {
+
+// This class handles the "Browser" target for remote debugging.
+class DevToolsBrowserTarget {
+ public:
+ class Handler {
+ public:
+ virtual ~Handler() {}
+
+ // |return_value| ownership is transferred to the caller.
+ virtual base::Value* OnProtocolCommand(
+ const std::string& method,
+ const base::DictionaryValue* params) = 0;
+
pfeldman 2012/12/14 18:35:05 nit: blank line
bulach 2012/12/14 19:53:39 Done.
+ };
+
+ explicit DevToolsBrowserTarget(int connection_id);
+ ~DevToolsBrowserTarget();
+
+ int connection_id() const { return connection_id_; }
+
+ // Takes ownership of |handler|.
+ void RegisterHandler(const std::string& domain, Handler* handler);
+
+ std::string HandleMessage(const std::string& data);
+
+ private:
+ const int connection_id_;
+
+ typedef std::map<std::string, Handler*> HandlersMap;
+ HandlersMap handlers_;
+
+ std::string CreateErrorResponse(int request_id, const std::string& message);
+ std::string CreateResponse(int request_id, base::Value* response);
+
+ DISALLOW_COPY_AND_ASSIGN(DevToolsBrowserTarget);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_BROWSER_TARGET_H_

Powered by Google App Engine
This is Rietveld 408576698