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

Unified Diff: webkit/plugins/npapi/webplugin_impl.cc

Issue 9844018: Keep a histogram of Flash version numbers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/npapi/webplugin_impl.cc
===================================================================
--- webkit/plugins/npapi/webplugin_impl.cc (revision 128562)
+++ webkit/plugins/npapi/webplugin_impl.cc (working copy)
@@ -86,6 +86,7 @@
const char kHTMLMimeType[] = "text/html";
const char kPlainTextMimeType[] = "text/plain";
const char kPluginFlashMimeType[] = "Plugin.FlashMIMEType";
+const char kPluginFlashVersion[] = "Plugin.FlashVersion";
enum {
MIME_TYPE_OK = 0,
@@ -244,6 +245,7 @@
linked_ptr<WebKit::WebURLLoader> loader;
bool notify_redirects;
bool is_plugin_src_load;
+ bool check_flash_version;
};
bool WebPluginImpl::initialize(WebPluginContainer* container) {
@@ -891,12 +893,14 @@
// Defend against content confusion by the Flash plug-in.
if (client_info->is_plugin_src_load &&
mime_type_ == kFlashMimeType) {
+ client_info->check_flash_version = true;
std::string sniff =
response.httpHeaderField("X-Content-Type-Options").utf8();
std::string content_type =
response.httpHeaderField("Content-Type").utf8();
StringToLowerASCII(&sniff);
StringToLowerASCII(&content_type);
+ // TODO(cevans): remove when we no longer need these.
if (content_type.find(kFlashMimeType) != std::string::npos) {
UMA_HISTOGRAM_ENUMERATION(kPluginFlashMimeType,
MIME_TYPE_OK,
@@ -1013,6 +1017,21 @@
if (!client)
return;
+ ClientInfo* client_info = GetClientInfoFromLoader(loader);
+ if (client_info && client_info->check_flash_version) {
+ client_info->check_flash_version = false;
+ if (data_length >= 4 &&
+ (buffer[0] == 'C' || buffer[1] == 'F') &&
+ buffer[1] == 'W' &&
+ buffer[2] == 'S') {
+ unsigned char version = static_cast<unsigned char>(buffer[3]);
+ // TODO(cevans): remove when we no longer need this.
+ UMA_HISTOGRAM_ENUMERATION(kPluginFlashVersion,
+ version,
+ 256);
+ }
+ }
+
MultiPartResponseHandlerMap::iterator index =
multi_part_response_map_.find(client);
if (index != multi_part_response_map_.end()) {
@@ -1203,6 +1222,7 @@
info.pending_failure_notification = false;
info.notify_redirects = notify_redirects;
info.is_plugin_src_load = is_plugin_src_load;
+ info.check_flash_version = false;
if (range_info) {
info.request.addHTTPHeaderField(WebString::fromUTF8("Range"),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698