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

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

Issue 2548263002: [DevTools] Migrate dom, emulation, inspector, network, page and schema handlers to new generator. (Closed)
Patch Set: rebased atop of roll Created 4 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
« no previous file with comments | « content/browser/devtools/devtools_session.h ('k') | content/browser/devtools/page_navigation_throttle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/devtools_session.cc
diff --git a/content/browser/devtools/devtools_session.cc b/content/browser/devtools/devtools_session.cc
index 7f115e550ec916bac9d1bb06a13217b98d015694..60ccb85ebebdd22377769751c2bcd04697f7bb2a 100644
--- a/content/browser/devtools/devtools_session.cc
+++ b/content/browser/devtools/devtools_session.cc
@@ -4,8 +4,12 @@
#include "content/browser/devtools/devtools_session.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "content/browser/devtools/devtools_agent_host_impl.h"
+#include "content/browser/devtools/devtools_manager.h"
#include "content/browser/devtools/protocol/protocol.h"
+#include "content/public/browser/devtools_manager_delegate.h"
namespace content {
@@ -23,6 +27,30 @@ void DevToolsSession::ResetDispatcher() {
dispatcher_.reset();
}
+protocol::Response::Status DevToolsSession::Dispatch(
+ const std::string& message,
+ int* call_id,
+ std::string* method) {
+ std::unique_ptr<base::Value> value = base::JSONReader::Read(message);
+
+ DevToolsManagerDelegate* delegate =
+ DevToolsManager::GetInstance()->delegate();
+ if (value && value->IsType(base::Value::Type::DICTIONARY) && delegate) {
+ std::unique_ptr<base::DictionaryValue> response(delegate->HandleCommand(
+ agent_host_,
+ static_cast<base::DictionaryValue*>(value.get())));
+ if (response) {
+ std::string json;
+ base::JSONWriter::Write(*response.get(), &json);
+ agent_host_->SendMessageToClient(session_id_, json);
+ return protocol::Response::kSuccess;
+ }
+ }
+
+ return dispatcher_->dispatch(protocol::toProtocolValue(value.get(), 1000),
+ call_id, method);
+}
+
void DevToolsSession::sendProtocolResponse(
int call_id,
std::unique_ptr<protocol::Serializable> message) {
« no previous file with comments | « content/browser/devtools/devtools_session.h ('k') | content/browser/devtools/page_navigation_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698