Popular sites on the NTP: re-download popular suggestions once per Chrome run
[chromium-blink-merge.git] / chrome / browser / devtools / devtools_protocol.h
blob06c82fbfa07b3b2aa8e351aa335619b0415392fd
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_
8 #include <string>
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 {
16 public:
17 // Caller maintains ownership of |command|. |*params| is owned by |command|.
18 static bool ParseCommand(const base::DictionaryValue* command,
19 int* command_id,
20 std::string* method,
21 const base::DictionaryValue** params);
23 static bool ParseNotification(const std::string& json,
24 std::string* method,
25 scoped_ptr<base::DictionaryValue>* params);
27 static bool ParseResponse(const std::string& json,
28 int* command_id,
29 int* error_code);
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(
36 int command_id,
37 scoped_ptr<base::DictionaryValue> result);
39 static scoped_ptr<base::DictionaryValue> CreateInvalidParamsResponse(
40 int command_id,
41 const std::string& param);
43 private:
44 DevToolsProtocol() {}
45 ~DevToolsProtocol() {}
48 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_H_