1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/values.h"
14 // Utility class for processing DevTools remote debugging messages.
15 class DevToolsProtocol
{
17 // Caller maintains ownership of |command|. |*params| is owned by |command|.
18 static bool ParseCommand(const base::DictionaryValue
* command
,
21 const base::DictionaryValue
** params
);
23 static bool ParseNotification(const std::string
& json
,
25 scoped_ptr
<base::DictionaryValue
>* params
);
27 static bool ParseResponse(const std::string
& json
,
31 static std::string
SerializeCommand(int command_id
,
32 const std::string
& method
,
33 scoped_ptr
<base::DictionaryValue
> params
);
35 static scoped_ptr
<base::DictionaryValue
> CreateSuccessResponse(
37 scoped_ptr
<base::DictionaryValue
> result
);
39 static scoped_ptr
<base::DictionaryValue
> CreateInvalidParamsResponse(
41 const std::string
& param
);
45 ~DevToolsProtocol() {}
48 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_