summaryrefslogtreecommitdiffstats
path: root/chrome/browser/devtools/devtools_network_protocol_handler.h
blob: 87f5c02f0b6f4116dceaff218cbbc7b58d6c5d5e (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
48
49
// Copyright 2014 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_NETWORK_PROTOCOL_HANDLER_H_
#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_PROTOCOL_HANDLER_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/devtools/devtools_protocol.h"

namespace content {
class DevToolsAgentHost;
}

class DevToolsNetworkConditions;
class Profile;

class DevToolsNetworkProtocolHandler {
 public:
  DevToolsNetworkProtocolHandler();
  ~DevToolsNetworkProtocolHandler();

  void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host,
                                 bool attached);
  base::DictionaryValue* HandleCommand(
      content::DevToolsAgentHost* agent_host,
      base::DictionaryValue* command_dict);

 private:
  scoped_ptr<base::DictionaryValue> CanEmulateNetworkConditions(
      content::DevToolsAgentHost* agent_host,
      int command_id,
      const base::DictionaryValue* params);

  scoped_ptr<base::DictionaryValue> EmulateNetworkConditions(
      content::DevToolsAgentHost* agent_host,
      int command_id,
      const base::DictionaryValue* params);

  void UpdateNetworkState(
      content::DevToolsAgentHost* agent_host,
      scoped_ptr<DevToolsNetworkConditions> conditions);

  DISALLOW_COPY_AND_ASSIGN(DevToolsNetworkProtocolHandler);
};

#endif  // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_NETWORK_PROTOCOL_HANDLER_H_