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"), |