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