Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1362)

Side by Side Diff: chrome/renderer/pepper/pepper_uma_host.cc

Issue 281803003: Add PPAPI_BEGIN_MESSAGE_MAP and PPAPI_END_MESSAGE_MAP to be used when dispatching IPCs using PPAPI_… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include "chrome/renderer/pepper/pepper_uma_host.h" 5 #include "chrome/renderer/pepper/pepper_uma_host.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 allowed_origins_.insert(kPredefinedAllowedUMAOrigins[i]); 50 allowed_origins_.insert(kPredefinedAllowedUMAOrigins[i]);
51 for (size_t i = 0; i < arraysize(kWhitelistedHistogramPrefixes); ++i) 51 for (size_t i = 0; i < arraysize(kWhitelistedHistogramPrefixes); ++i)
52 allowed_histogram_prefixes_.insert(kWhitelistedHistogramPrefixes[i]); 52 allowed_histogram_prefixes_.insert(kWhitelistedHistogramPrefixes[i]);
53 } 53 }
54 54
55 PepperUMAHost::~PepperUMAHost() {} 55 PepperUMAHost::~PepperUMAHost() {}
56 56
57 int32_t PepperUMAHost::OnResourceMessageReceived( 57 int32_t PepperUMAHost::OnResourceMessageReceived(
58 const IPC::Message& msg, 58 const IPC::Message& msg,
59 ppapi::host::HostMessageContext* context) { 59 ppapi::host::HostMessageContext* context) {
60 IPC_BEGIN_MESSAGE_MAP(PepperUMAHost, msg) 60 PPAPI_BEGIN_MESSAGE_MAP(PepperUMAHost, msg)
61 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramCustomTimes, 61 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramCustomTimes,
62 OnHistogramCustomTimes); 62 OnHistogramCustomTimes)
63 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramCustomCounts, 63 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramCustomCounts,
64 OnHistogramCustomCounts); 64 OnHistogramCustomCounts)
65 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration, 65 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration,
66 OnHistogramEnumeration); 66 OnHistogramEnumeration)
67 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_UMA_IsCrashReportingEnabled, 67 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
68 OnIsCrashReportingEnabled); 68 PpapiHostMsg_UMA_IsCrashReportingEnabled, OnIsCrashReportingEnabled)
69 IPC_END_MESSAGE_MAP() 69 PPAPI_END_MESSAGE_MAP()
70 return PP_ERROR_FAILED; 70 return PP_ERROR_FAILED;
71 } 71 }
72 72
73 bool PepperUMAHost::IsPluginWhitelisted() { 73 bool PepperUMAHost::IsPluginWhitelisted() {
74 return ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( 74 return ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted(
75 document_url_, allowed_origins_); 75 document_url_, allowed_origins_);
76 } 76 }
77 77
78 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { 78 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) {
79 if (is_plugin_in_process_ && histogram.find("NaCl.") == 0) { 79 if (is_plugin_in_process_ && histogram.find("NaCl.") == 0) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 ppapi::host::HostMessageContext* context) { 173 ppapi::host::HostMessageContext* context) {
174 if (!IsPluginWhitelisted()) 174 if (!IsPluginWhitelisted())
175 return PP_ERROR_NOACCESS; 175 return PP_ERROR_NOACCESS;
176 bool enabled = false; 176 bool enabled = false;
177 content::RenderThread::Get()->Send( 177 content::RenderThread::Get()->Send(
178 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); 178 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled));
179 if (enabled) 179 if (enabled)
180 return PP_OK; 180 return PP_OK;
181 return PP_ERROR_FAILED; 181 return PP_ERROR_FAILED;
182 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698