Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / stats_collection_controller.h
blobc36349c51a2dfdaf43297c3838ac7fac5dc5abf9
1 // Copyright 2013 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 CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_
6 #define CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_
8 #include "base/basictypes.h"
9 #include "gin/wrappable.h"
11 namespace blink {
12 class WebFrame;
15 namespace content {
17 // This class is exposed in JS as window.statsCollectionController and provides
18 // functionality to read out statistics from the browser.
19 // Its use must be enabled specifically via the
20 // --enable-stats-collection-bindings command line flag.
21 class StatsCollectionController
22 : public gin::Wrappable<StatsCollectionController> {
23 public:
24 static gin::WrapperInfo kWrapperInfo;
26 static void Install(blink::WebFrame* frame);
28 private:
29 StatsCollectionController();
30 ~StatsCollectionController() override;
32 // gin::WrappableBase
33 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
34 v8::Isolate* isolate) override;
36 // Retrieves a histogram and returns a JSON representation of it.
37 std::string GetHistogram(const std::string& histogram_name);
39 // Retrieves a histogram from the browser process and returns a JSON
40 // representation of it.
41 std::string GetBrowserHistogram(const std::string& histogram_name);
43 // Returns JSON representation of tab timing information for the current tab.
44 std::string GetTabLoadTiming();
46 DISALLOW_COPY_AND_ASSIGN(StatsCollectionController);
49 } // namespace content
51 #endif // CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_