Index: chrome/browser/devtools/devtools_power_profiler_host.h |
diff --git a/chrome/browser/devtools/devtools_power_profiler_host.h b/chrome/browser/devtools/devtools_power_profiler_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..50e2f550cbea23a3cd8852f23a2643d95e8f8f54 |
--- /dev/null |
+++ b/chrome/browser/devtools/devtools_power_profiler_host.h |
@@ -0,0 +1,33 @@ |
+// 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_POWER_PROFILER_HOST_H_ |
+#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_POWER_PROFILER_HOST_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/values.h" |
+#include "chrome/browser/devtools/devtools_window.h" |
+#include "content/public/browser/power_profiler_observer.h" |
+ |
+class DevToolsWindow; |
+ |
+// A class used to monitor the power usage and tell profiler the power data |
+class DevToolsPowerProfilerHost : public content::PowerProfilerObserver { |
+ public: |
+ explicit DevToolsPowerProfilerHost(const base::WeakPtr<DevToolsWindow>&); |
+ ~DevToolsPowerProfilerHost() {} |
+ virtual void Send(content::PowerEvent*) OVERRIDE; |
+ |
+ private: |
+ void SendWrapper(const std::string& message); |
+ base::Time convertMonotonicTimeToWallTime(base::TimeTicks&); |
+ void convertPowerValueToJSONObject(base::DictionaryValue*, |
+ content::PowerEvent*); |
+ base::WeakPtr<DevToolsWindow> frontend_host_; |
+ DISALLOW_COPY_AND_ASSIGN(DevToolsPowerProfilerHost); |
+}; |
+ |
+#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_POWER_PROFILER_HOST_H_ |