1 // Copyright 2014 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_RENDERER_PEPPER_PEPPER_UMA_HOST_H_
6 #define CHROME_RENDERER_PEPPER_PEPPER_UMA_HOST_H_
11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/host/resource_host.h"
17 class RendererPpapiHost;
22 struct HostMessageContext;
26 class PepperUMAHost : public ppapi::host::ResourceHost {
28 PepperUMAHost(content::RendererPpapiHost* host,
30 PP_Resource resource);
32 virtual ~PepperUMAHost();
34 // ppapi::host::ResourceMessageHandler implementation.
35 virtual int32_t OnResourceMessageReceived(
36 const IPC::Message& msg,
37 ppapi::host::HostMessageContext* context) OVERRIDE;
40 bool IsPluginWhitelisted();
41 bool IsHistogramAllowed(const std::string& histogram);
43 int32_t OnHistogramCustomTimes(
44 ppapi::host::HostMessageContext* context,
45 const std::string& name,
49 uint32_t bucket_count);
51 int32_t OnHistogramCustomCounts(
52 ppapi::host::HostMessageContext* context,
53 const std::string& name,
57 uint32_t bucket_count);
59 int32_t OnHistogramEnumeration(
60 ppapi::host::HostMessageContext* context,
61 const std::string& name,
63 int32_t boundary_value);
65 int32_t OnIsCrashReportingEnabled(
66 ppapi::host::HostMessageContext* context);
68 const GURL document_url_;
69 bool is_plugin_in_process_;
71 // Set of origins that can use UMA private APIs from NaCl.
72 std::set<std::string> allowed_origins_;
73 // Set of hashed histogram prefixes that can be used from this interface.
74 std::set<std::string> allowed_histogram_prefixes_;
76 DISALLOW_COPY_AND_ASSIGN(PepperUMAHost);
79 #endif // CHROME_RENDERER_PEPPER_PEPPER_UMA_HOST_H_