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

Unified Diff: content/browser/devtools/devtools_protocol.cc

Issue 12218134: Introduce intercepting and handling devtools messages in the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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/devtools_protocol.cc
diff --git a/content/browser/devtools/devtools_protocol.cc b/content/browser/devtools/devtools_protocol.cc
index 152a04ed26b1d638a1ef11aba994ab02af8ce82b..88e9571aa857b47a5a1b7ff97e43893aba28c657 100644
--- a/content/browser/devtools/devtools_protocol.cc
+++ b/content/browser/devtools/devtools_protocol.cc
@@ -118,6 +118,35 @@ std::string DevToolsProtocol::Notification::Serialize() {
return json_notification;
}
+DevToolsProtocol::Handler::~Handler() {
+}
+
+DevToolsProtocol::Handler::Handler(const Notifier& notifier)
pfeldman 2013/02/13 17:38:24 Method definition order should match the declarati
kkania 2013/02/13 19:17:19 Done.
+ : notifier_(notifier) {
+}
+
+scoped_ptr<DevToolsProtocol::Response>
+DevToolsProtocol::Handler::HandleCommand(
+ DevToolsProtocol::Command* command) {
+ CommandHandlers::iterator it = command_handlers_.find(command->method());
+ if (it == command_handlers_.end())
+ return scoped_ptr<DevToolsProtocol::Response>();
+ return (it->second).Run(command);
+}
+
+void DevToolsProtocol::Handler::RegisterCommandHandler(
+ const std::string& command,
+ const CommandHandler& handler) {
+ command_handlers_[command] = handler;
+}
+
+void DevToolsProtocol::Handler::SendNotification(
+ const std::string& method,
+ base::DictionaryValue* params) {
+ DevToolsProtocol::Notification notification(method, params);
+ notifier_.Run(notification.Serialize());
+}
+
// static
DevToolsProtocol::Command* DevToolsProtocol::ParseCommand(
const std::string& json,

Powered by Google App Engine
This is Rietveld 408576698