Commit ba2b758d authored by cevans@chromium.org's avatar cevans@chromium.org

Keep a histogram of Flash version numbers.

BUG=120634
Review URL: https://chromiumcodereview.appspot.com/9844018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129458 0039d316-1c4b-4281-b951-d872f2087c98
parent 1e5a5346
......@@ -86,6 +86,7 @@ const char kOctetStreamMimeType[] = "application/octet-stream";
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 @@ struct WebPluginImpl::ClientInfo {
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 @@ void WebPluginImpl::didReceiveResponse(WebURLLoader* loader,
// 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 @@ void WebPluginImpl::didReceiveData(WebURLLoader* loader,
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 @@ bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id,
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"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment