summaryrefslogtreecommitdiffstats
path: root/content/browser/devtools/devtools_power_handler.h
blob: f645392a1993a81a139f4e56d85f89638097111d (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
// 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 CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_POWER_HANDLER_H_
#define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_POWER_HANDLER_H_

#include "base/time/time.h"
#include "content/browser/devtools/devtools_protocol.h"
#include "content/browser/power_profiler/power_profiler_observer.h"

namespace content {

// This class provides power information to DevTools.
class DevToolsPowerHandler
    : public DevToolsProtocol::Handler,
      public PowerProfilerObserver {
 public:
  DevToolsPowerHandler();
  virtual ~DevToolsPowerHandler();

  // PowerProfilerObserver override.
  virtual void OnPowerEvent(const PowerEventVector&) OVERRIDE;

 private:
  scoped_refptr<DevToolsProtocol::Response> OnStart(
      scoped_refptr<DevToolsProtocol::Command> command);
  scoped_refptr<DevToolsProtocol::Response> OnEnd(
      scoped_refptr<DevToolsProtocol::Command> command);
  scoped_refptr<DevToolsProtocol::Response> OnCanProfilePower(
      scoped_refptr<DevToolsProtocol::Command> command);

  DISALLOW_COPY_AND_ASSIGN(DevToolsPowerHandler);
};

}  // namespace content

#endif  // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_POWER_HANDLER_H_