OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/buffered_resource_handler.h" | 5 #include "content/browser/renderer_host/buffered_resource_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "net/base/mime_util.h" | 22 #include "net/base/mime_util.h" |
23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
24 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
25 #include "webkit/plugins/npapi/plugin_list.h" | 25 #include "webkit/plugins/npapi/plugin_list.h" |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 void RecordSnifferMetrics(bool sniffing_blocked, | 29 void RecordSnifferMetrics(bool sniffing_blocked, |
30 bool we_would_like_to_sniff, | 30 bool we_would_like_to_sniff, |
31 const std::string& mime_type) { | 31 const std::string& mime_type) { |
32 scoped_refptr<base::Histogram> nosniff_usage = | 32 static base::Histogram* nosniff_usage(NULL); |
33 base::BooleanHistogram::FactoryGet( | 33 if (!nosniff_usage) |
34 "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag); | 34 nosniff_usage = base::BooleanHistogram::FactoryGet( |
| 35 "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag); |
35 nosniff_usage->AddBoolean(sniffing_blocked); | 36 nosniff_usage->AddBoolean(sniffing_blocked); |
36 | 37 |
37 if (sniffing_blocked) { | 38 if (sniffing_blocked) { |
38 scoped_refptr<base::Histogram> nosniff_otherwise = | 39 static base::Histogram* nosniff_otherwise(NULL); |
39 base::BooleanHistogram::FactoryGet( | 40 if (!nosniff_otherwise) |
40 "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag); | 41 nosniff_otherwise = base::BooleanHistogram::FactoryGet( |
| 42 "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag); |
41 nosniff_otherwise->AddBoolean(we_would_like_to_sniff); | 43 nosniff_otherwise->AddBoolean(we_would_like_to_sniff); |
42 | 44 |
43 scoped_refptr<base::Histogram> nosniff_empty_mime_type = | 45 static base::Histogram* nosniff_empty_mime_type(NULL); |
44 base::BooleanHistogram::FactoryGet( | 46 if (!nosniff_empty_mime_type) |
45 "nosniff.empty_mime_type", | 47 nosniff_empty_mime_type = base::BooleanHistogram::FactoryGet( |
46 base::Histogram::kUmaTargetedHistogramFlag); | 48 "nosniff.empty_mime_type", |
| 49 base::Histogram::kUmaTargetedHistogramFlag); |
47 nosniff_empty_mime_type->AddBoolean(mime_type.empty()); | 50 nosniff_empty_mime_type->AddBoolean(mime_type.empty()); |
48 } | 51 } |
49 } | 52 } |
50 | 53 |
51 } // namespace | 54 } // namespace |
52 | 55 |
53 BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler, | 56 BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler, |
54 ResourceDispatcherHost* host, | 57 ResourceDispatcherHost* host, |
55 net::URLRequest* request) | 58 net::URLRequest* request) |
56 : real_handler_(handler), | 59 : real_handler_(handler), |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 wait_for_plugins_ = false; | 485 wait_for_plugins_ = false; |
483 if (!request_) | 486 if (!request_) |
484 return; | 487 return; |
485 | 488 |
486 ResourceDispatcherHostRequestInfo* info = | 489 ResourceDispatcherHostRequestInfo* info = |
487 ResourceDispatcherHost::InfoForRequest(request_); | 490 ResourceDispatcherHost::InfoForRequest(request_); |
488 host_->PauseRequest(info->child_id(), info->request_id(), false); | 491 host_->PauseRequest(info->child_id(), info->request_id(), false); |
489 if (!CompleteResponseStarted(info->request_id(), false)) | 492 if (!CompleteResponseStarted(info->request_id(), false)) |
490 host_->CancelRequest(info->child_id(), info->request_id(), false); | 493 host_->CancelRequest(info->child_id(), info->request_id(), false); |
491 } | 494 } |
OLD | NEW |