blob: 73ac261d05cbe48ac73ab647355bb858d31a2b43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright (c) 2013 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_
#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_
#include <string>
#include "base/compiler_specific.h"
#include "base/values.h"
// Utility class for processing DevTools remote debugging messages.
class DevToolsProtocol {
public:
// Caller maintains ownership of |command|. |*params| is owned by |command|.
static bool ParseCommand(base::DictionaryValue* command,
int* command_id,
std::string* method,
base::DictionaryValue** params);
static bool ParseNotification(const std::string& json,
std::string* method,
scoped_ptr<base::DictionaryValue>* params);
static bool ParseResponse(const std::string& json,
int* command_id,
int* error_code);
static std::string SerializeCommand(int command_id,
const std::string& method,
scoped_ptr<base::DictionaryValue> params);
static scoped_ptr<base::DictionaryValue> CreateSuccessResponse(
int command_id,
scoped_ptr<base::DictionaryValue> result);
static scoped_ptr<base::DictionaryValue> CreateInvalidParamsResponse(
int command_id,
const std::string& param);
private:
DevToolsProtocol() {}
~DevToolsProtocol() {}
};
#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_
|