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

Side by Side Diff: content/browser/loader/buffered_resource_handler.cc

Issue 525513003: Cleanup: Put more plugin code behind the ENABLE_PLUGINS ifdef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/loader/buffered_resource_handler.h" 5 #include "content/browser/loader/buffered_resource_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "content/browser/download/download_resource_handler.h" 13 #include "content/browser/download/download_resource_handler.h"
14 #include "content/browser/download/download_stats.h" 14 #include "content/browser/download/download_stats.h"
15 #include "content/browser/loader/certificate_resource_handler.h" 15 #include "content/browser/loader/certificate_resource_handler.h"
16 #include "content/browser/loader/resource_dispatcher_host_impl.h" 16 #include "content/browser/loader/resource_dispatcher_host_impl.h"
17 #include "content/browser/loader/resource_request_info_impl.h" 17 #include "content/browser/loader/resource_request_info_impl.h"
18 #include "content/browser/loader/stream_resource_handler.h" 18 #include "content/browser/loader/stream_resource_handler.h"
19 #include "content/browser/plugin_service_impl.h"
20 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
21 #include "content/public/browser/download_item.h" 20 #include "content/public/browser/download_item.h"
22 #include "content/public/browser/download_save_info.h" 21 #include "content/public/browser/download_save_info.h"
23 #include "content/public/browser/download_url_parameters.h" 22 #include "content/public/browser/download_url_parameters.h"
24 #include "content/public/browser/resource_context.h" 23 #include "content/public/browser/resource_context.h"
25 #include "content/public/browser/resource_dispatcher_host_delegate.h" 24 #include "content/public/browser/resource_dispatcher_host_delegate.h"
26 #include "content/public/common/resource_response.h" 25 #include "content/public/common/resource_response.h"
27 #include "content/public/common/webplugininfo.h" 26 #include "content/public/common/webplugininfo.h"
28 #include "net/base/io_buffer.h" 27 #include "net/base/io_buffer.h"
29 #include "net/base/mime_sniffer.h" 28 #include "net/base/mime_sniffer.h"
30 #include "net/base/mime_util.h" 29 #include "net/base/mime_util.h"
31 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
32 #include "net/http/http_content_disposition.h" 31 #include "net/http/http_content_disposition.h"
33 #include "net/http/http_response_headers.h" 32 #include "net/http/http_response_headers.h"
34 33
34 #if defined(ENABLE_PLUGINS)
35 #include "content/browser/plugin_service_impl.h"
36 #endif
37
35 namespace content { 38 namespace content {
36 39
37 namespace { 40 namespace {
38 41
39 void RecordSnifferMetrics(bool sniffing_blocked, 42 void RecordSnifferMetrics(bool sniffing_blocked,
40 bool we_would_like_to_sniff, 43 bool we_would_like_to_sniff,
41 const std::string& mime_type) { 44 const std::string& mime_type) {
42 static base::HistogramBase* nosniff_usage(NULL); 45 static base::HistogramBase* nosniff_usage(NULL);
43 if (!nosniff_usage) 46 if (!nosniff_usage)
44 nosniff_usage = base::BooleanHistogram::FactoryGet( 47 nosniff_usage = base::BooleanHistogram::FactoryGet(
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #endif 344 #endif
342 } 345 }
343 346
344 // Install download handler 347 // Install download handler
345 info->set_is_download(true); 348 info->set_is_download(true);
346 scoped_ptr<ResourceHandler> handler( 349 scoped_ptr<ResourceHandler> handler(
347 host_->CreateResourceHandlerForDownload( 350 host_->CreateResourceHandlerForDownload(
348 request(), 351 request(),
349 true, // is_content_initiated 352 true, // is_content_initiated
350 must_download, 353 must_download,
351 content::DownloadItem::kInvalidId, 354 DownloadItem::kInvalidId,
352 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), 355 scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()),
353 DownloadUrlParameters::OnStartedCallback())); 356 DownloadUrlParameters::OnStartedCallback()));
354 return UseAlternateNextHandler(handler.Pass(), std::string()); 357 return UseAlternateNextHandler(handler.Pass(), std::string());
355 } 358 }
356 359
357 bool BufferedResourceHandler::UseAlternateNextHandler( 360 bool BufferedResourceHandler::UseAlternateNextHandler(
358 scoped_ptr<ResourceHandler> new_handler, 361 scoped_ptr<ResourceHandler> new_handler,
359 const std::string& payload_for_old_handler) { 362 const std::string& payload_for_old_handler) {
360 if (response_->head.headers.get() && // Can be NULL if FTP. 363 if (response_->head.headers.get() && // Can be NULL if FTP.
361 response_->head.headers->response_code() / 100 != 2) { 364 response_->head.headers->response_code() / 100 != 2) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 request()->LogUnblocked(); 494 request()->LogUnblocked();
492 bool defer = false; 495 bool defer = false;
493 if (!ProcessResponse(&defer)) { 496 if (!ProcessResponse(&defer)) {
494 controller()->Cancel(); 497 controller()->Cancel();
495 } else if (!defer) { 498 } else if (!defer) {
496 controller()->Resume(); 499 controller()->Resume();
497 } 500 }
498 } 501 }
499 502
500 } // namespace content 503 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/debug_urls.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698