| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_WEB_UI_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_WEB_UI_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_WEB_UI_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_WEB_UI_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/public/browser/web_ui_message_handler.h" | 10 #include "content/public/browser/web_ui_message_handler.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class ListValue; | 13 class ListValue; |
| 14 class Time; | 14 class Time; |
| 15 class Value; |
| 15 } // namespace base | 16 } // namespace base |
| 16 | 17 |
| 17 namespace performance_monitor { | 18 namespace performance_monitor { |
| 18 | 19 |
| 19 // This class handles messages to and from the performance monitor page. | 20 // This class handles messages to and from the performance monitor page. |
| 20 // Incoming calls are handled by the Handle* functions and callbacks are made | 21 // Incoming calls are handled by the Handle* functions and callbacks are made |
| 21 // from ReturnResults functions. | 22 // from ReturnResults functions. |
| 22 class WebUIHandler : public content::WebUIMessageHandler, | 23 class WebUIHandler : public content::WebUIMessageHandler, |
| 23 public base::SupportsWeakPtr<WebUIHandler> { | 24 public base::SupportsWeakPtr<WebUIHandler> { |
| 24 public: | 25 public: |
| 25 WebUIHandler(); | 26 WebUIHandler(); |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 virtual ~WebUIHandler(); | 29 virtual ~WebUIHandler(); |
| 29 | 30 |
| 30 // WebUIMessageHandler implementation. | 31 // WebUIMessageHandler implementation. |
| 31 virtual void RegisterMessages() OVERRIDE; | 32 virtual void RegisterMessages() OVERRIDE; |
| 32 | 33 |
| 33 // Returns |results| through the given |callback| string. | 34 // Returns |results| through the given |callback| string. |
| 34 void ReturnResults(const std::string& callback, | 35 void ReturnResults(const std::string& callback, const base::Value* results); |
| 35 const base::ListValue* results); | |
| 36 | 36 |
| 37 // Callback for the "getActiveIntervals" message. | 37 // Callback for the "getActiveIntervals" message. |
| 38 // |args| contains a start and an end time. |
| 38 void HandleGetActiveIntervals(const base::ListValue* args); | 39 void HandleGetActiveIntervals(const base::ListValue* args); |
| 39 | 40 |
| 40 // Callback for the "getAllEventTypes" message. | 41 // Callback for the "getAllEventTypes" message. |
| 42 // |args| is unused. |
| 41 void HandleGetAllEventTypes(const base::ListValue* args); | 43 void HandleGetAllEventTypes(const base::ListValue* args); |
| 42 | 44 |
| 43 // Callback for the "getEvents" message. | 45 // Callback for the "getEvents" message. |
| 46 // |args| contains an EventType id to collect and a start and end time. |
| 44 void HandleGetEvents(const base::ListValue* args); | 47 void HandleGetEvents(const base::ListValue* args); |
| 45 | 48 |
| 49 // Callback for the "getAllMetricTypes" message. |
| 50 // |args| is unused. |
| 51 void HandleGetAllMetricTypes(const base::ListValue* args); |
| 52 |
| 53 // Callback for the "getMetric" message. |
| 54 // |args| contains a MetricType id to collect, a start and end time, and a |
| 55 // time resolution which defines the spacing of metric samples returned. |
| 56 void HandleGetMetric(const base::ListValue* args); |
| 57 |
| 46 DISALLOW_COPY_AND_ASSIGN(WebUIHandler); | 58 DISALLOW_COPY_AND_ASSIGN(WebUIHandler); |
| 47 }; | 59 }; |
| 48 | 60 |
| 49 } // namespace performance_monitor | 61 } // namespace performance_monitor |
| 50 | 62 |
| 51 #endif // CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_WEB_UI_HANDLER_H_ | 63 #endif // CHROME_BROWSER_UI_WEBUI_PERFORMANCE_MONITOR_WEB_UI_HANDLER_H_ |
| OLD | NEW |