1 // Copyright (c) 2012 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_UI_WEBUI_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "content/public/browser/web_ui_message_handler.h"
18 namespace performance_monitor {
20 // This class handles messages to and from the performance monitor page.
21 // Incoming calls are handled by the Handle* functions and callbacks are made
22 // from ReturnResults functions.
23 class PerformanceMonitorHandler
24 : public content::WebUIMessageHandler,
25 public base::SupportsWeakPtr<PerformanceMonitorHandler> {
27 PerformanceMonitorHandler();
30 virtual ~PerformanceMonitorHandler();
32 // WebUIMessageHandler implementation.
33 virtual void RegisterMessages() OVERRIDE;
35 // Returns |results| through the given |callback| string.
36 void ReturnResults(const std::string& callback, const base::Value* results);
38 // Callback for the "getActiveIntervals" message.
39 // |args| contains a start and an end time.
40 void HandleGetActiveIntervals(const base::ListValue* args);
42 // Callback for the "getFlagEnabled" message.
44 void HandleGetFlagEnabled(const base::ListValue* args);
46 // Callback for the "getAggregationTypes" message.
48 void HandleGetAggregationTypes(const base::ListValue* args);
50 // Callback for the "getEventTypes" message.
52 void HandleGetEventTypes(const base::ListValue* args);
54 // Callback for the "getEvents" message.
55 // |args| contains an EventType id to collect and a start and end time.
56 void HandleGetEvents(const base::ListValue* args);
58 // Callback for the "getMetricTypes" message.
60 void HandleGetMetricTypes(const base::ListValue* args);
62 // Callback for the "getMetrics" message.
63 // |args| contains a list of MetricTypes to collect, a start and end time,
64 // a time resolution (defining the spacing of metric samples returned),
65 // and an aggregation method.
66 void HandleGetMetrics(const base::ListValue* args);
68 DISALLOW_COPY_AND_ASSIGN(PerformanceMonitorHandler);
71 } // namespace performance_monitor
73 #endif // CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_HANDLER_H_