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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_socket_utils.cc

Issue 1132093003: Add metrics to record TCP/UDP connections made from Flash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
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 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h" 5 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/content_browser_client.h" 14 #include "content/public/browser/content_browser_client.h"
15 #include "content/public/browser/render_frame_host.h" 15 #include "content/public/browser/render_frame_host.h"
16 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
17 #include "content/public/browser/user_metrics.h"
17 #include "content/public/common/content_client.h" 18 #include "content/public/common/content_client.h"
19 #include "content/public/common/content_constants.h"
18 #include "net/cert/x509_certificate.h" 20 #include "net/cert/x509_certificate.h"
21 #include "ppapi/c/pp_errors.h"
19 #include "ppapi/c/private/ppb_net_address_private.h" 22 #include "ppapi/c/private/ppb_net_address_private.h"
20 #include "ppapi/shared_impl/private/net_address_private_impl.h" 23 #include "ppapi/shared_impl/private/net_address_private_impl.h"
21 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h" 24 #include "ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h"
22 25
23 namespace content { 26 namespace content {
24 namespace pepper_socket_utils { 27 namespace pepper_socket_utils {
25 28
26 SocketPermissionRequest CreateSocketPermissionRequest( 29 SocketPermissionRequest CreateSocketPermissionRequest(
27 SocketPermissionRequest::OperationType type, 30 SocketPermissionRequest::OperationType type,
28 const PP_NetAddress_Private& net_addr) { 31 const PP_NetAddress_Private& net_addr) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 bool GetCertificateFields(const char* der, 124 bool GetCertificateFields(const char* der,
122 uint32_t length, 125 uint32_t length,
123 ppapi::PPB_X509Certificate_Fields* fields) { 126 ppapi::PPB_X509Certificate_Fields* fields) {
124 scoped_refptr<net::X509Certificate> cert = 127 scoped_refptr<net::X509Certificate> cert =
125 net::X509Certificate::CreateFromBytes(der, length); 128 net::X509Certificate::CreateFromBytes(der, length);
126 if (!cert.get()) 129 if (!cert.get())
127 return false; 130 return false;
128 return GetCertificateFields(*cert.get(), fields); 131 return GetCertificateFields(*cert.get(), fields);
129 } 132 }
130 133
134 void RecordFlashConnectMetric(const std::string& plugin_module_name,
135 const GURL& plugin_url) {
136 // Only record Flash connections.
137 if (plugin_module_name != content::kFlashPluginName)
138 return;
139
140 if (plugin_url.SchemeIs(url::kHttpsScheme)) {
141 content::RecordAction(
142 base::UserMetricsAction("Flash_SocketConnect_Secure"));
143 } else {
144 content::RecordAction(
145 base::UserMetricsAction("Flash_SocketConnect_Insecure"));
146 }
147 }
148
131 } // namespace pepper_socket_utils 149 } // namespace pepper_socket_utils
132 } // namespace content 150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698