| OLD | NEW |
| 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/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/debug/alias.h" | 13 #include "base/debug/alias.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/ref_counted_memory.h" | 17 #include "base/memory/ref_counted_memory.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/profiler/scoped_tracker.h" | 19 #include "base/profiler/scoped_tracker.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 24 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 25 #include "content/browser/histogram_internals_request_job.h" | 25 #include "content/browser/histogram_internals_request_job.h" |
| 26 #include "content/browser/net/view_blob_internals_job_factory.h" | 26 #include "content/browser/net/view_blob_internals_job_factory.h" |
| 27 #include "content/browser/net/view_http_cache_job_factory.h" | 27 #include "content/browser/net/view_http_cache_job_factory.h" |
| 28 #include "content/browser/resource_context_impl.h" | 28 #include "content/browser/resource_context_impl.h" |
| 29 #include "content/browser/tcmalloc_internals_request_job.h" | |
| 30 #include "content/browser/webui/shared_resources_data_source.h" | 29 #include "content/browser/webui/shared_resources_data_source.h" |
| 31 #include "content/browser/webui/url_data_source_impl.h" | 30 #include "content/browser/webui/url_data_source_impl.h" |
| 32 #include "content/public/browser/browser_context.h" | 31 #include "content/public/browser/browser_context.h" |
| 33 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/content_browser_client.h" | 33 #include "content/public/browser/content_browser_client.h" |
| 35 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| 36 #include "content/public/browser/resource_request_info.h" | 35 #include "content/public/browser/resource_request_info.h" |
| 37 #include "content/public/common/url_constants.h" | 36 #include "content/public/common/url_constants.h" |
| 38 #include "net/base/io_buffer.h" | 37 #include "net/base/io_buffer.h" |
| 39 #include "net/base/net_errors.h" | 38 #include "net/base/net_errors.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) | 476 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) |
| 478 return ViewHttpCacheJobFactory::CreateJobForRequest(request, | 477 return ViewHttpCacheJobFactory::CreateJobForRequest(request, |
| 479 network_delegate); | 478 network_delegate); |
| 480 | 479 |
| 481 // Next check for chrome://blob-internals/, which uses its own job type. | 480 // Next check for chrome://blob-internals/, which uses its own job type. |
| 482 if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) { | 481 if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) { |
| 483 return ViewBlobInternalsJobFactory::CreateJobForRequest( | 482 return ViewBlobInternalsJobFactory::CreateJobForRequest( |
| 484 request, network_delegate, blob_storage_context_->context()); | 483 request, network_delegate, blob_storage_context_->context()); |
| 485 } | 484 } |
| 486 | 485 |
| 487 #if defined(USE_TCMALLOC) | |
| 488 // Next check for chrome://tcmalloc/, which uses its own job type. | |
| 489 if (request->url().SchemeIs(kChromeUIScheme) && | |
| 490 request->url().host() == kChromeUITcmallocHost) { | |
| 491 return new TcmallocInternalsRequestJob(request, network_delegate); | |
| 492 } | |
| 493 #endif | |
| 494 | |
| 495 // Next check for chrome://histograms/, which uses its own job type. | 486 // Next check for chrome://histograms/, which uses its own job type. |
| 496 if (request->url().SchemeIs(kChromeUIScheme) && | 487 if (request->url().SchemeIs(kChromeUIScheme) && |
| 497 request->url().host() == kChromeUIHistogramHost) { | 488 request->url().host() == kChromeUIHistogramHost) { |
| 498 return new HistogramInternalsRequestJob(request, network_delegate); | 489 return new HistogramInternalsRequestJob(request, network_delegate); |
| 499 } | 490 } |
| 500 | 491 |
| 501 // Fall back to using a custom handler | 492 // Fall back to using a custom handler |
| 502 return new URLRequestChromeJob( | 493 return new URLRequestChromeJob( |
| 503 request, network_delegate, | 494 request, network_delegate, |
| 504 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); | 495 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 755 |
| 765 } // namespace | 756 } // namespace |
| 766 | 757 |
| 767 net::URLRequestJobFactory::ProtocolHandler* | 758 net::URLRequestJobFactory::ProtocolHandler* |
| 768 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 759 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
| 769 bool is_incognito) { | 760 bool is_incognito) { |
| 770 return new DevToolsJobFactory(resource_context, is_incognito); | 761 return new DevToolsJobFactory(resource_context, is_incognito); |
| 771 } | 762 } |
| 772 | 763 |
| 773 } // namespace content | 764 } // namespace content |
| OLD | NEW |