| 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 "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 5 #include "chrome/browser/ui/webui/chrome_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" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 if (inspector_dir.empty()) | 561 if (inspector_dir.empty()) |
| 562 return false; | 562 return false; |
| 563 | 563 |
| 564 *path = inspector_dir.AppendASCII(relative_path); | 564 *path = inspector_dir.AppendASCII(relative_path); |
| 565 return true; | 565 return true; |
| 566 } | 566 } |
| 567 | 567 |
| 568 class DevToolsJobFactory | 568 class DevToolsJobFactory |
| 569 : public net::URLRequestJobFactory::ProtocolHandler { | 569 : public net::URLRequestJobFactory::ProtocolHandler { |
| 570 public: | 570 public: |
| 571 explicit DevToolsJobFactory(ChromeURLDataManagerBackend* backend); | 571 explicit DevToolsJobFactory(ChromeURLDataManagerBackend* backend, |
| 572 net::NetworkDelegate* network_delegate); |
| 572 virtual ~DevToolsJobFactory(); | 573 virtual ~DevToolsJobFactory(); |
| 573 | 574 |
| 574 virtual net::URLRequestJob* MaybeCreateJob( | 575 virtual net::URLRequestJob* MaybeCreateJob( |
| 575 net::URLRequest* request) const OVERRIDE; | 576 net::URLRequest* request) const OVERRIDE; |
| 576 | 577 |
| 577 private: | 578 private: |
| 578 // |backend_| is owned by ProfileIOData, which owns this ProtocolHandler. | 579 // |backend_| is owned by ProfileIOData, which owns this ProtocolHandler. |
| 579 ChromeURLDataManagerBackend* const backend_; | 580 ChromeURLDataManagerBackend* const backend_; |
| 580 | 581 |
| 582 net::NetworkDelegate* network_delegate_; |
| 583 |
| 581 DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory); | 584 DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory); |
| 582 }; | 585 }; |
| 583 | 586 |
| 584 DevToolsJobFactory::DevToolsJobFactory(ChromeURLDataManagerBackend* backend) | 587 DevToolsJobFactory::DevToolsJobFactory(ChromeURLDataManagerBackend* backend, |
| 585 : backend_(backend) { | 588 net::NetworkDelegate* network_delegate) |
| 589 : backend_(backend), |
| 590 network_delegate_(network_delegate) { |
| 586 DCHECK(backend_); | 591 DCHECK(backend_); |
| 587 } | 592 } |
| 588 | 593 |
| 589 DevToolsJobFactory::~DevToolsJobFactory() {} | 594 DevToolsJobFactory::~DevToolsJobFactory() {} |
| 590 | 595 |
| 591 net::URLRequestJob* | 596 net::URLRequestJob* |
| 592 DevToolsJobFactory::MaybeCreateJob(net::URLRequest* request) const { | 597 DevToolsJobFactory::MaybeCreateJob(net::URLRequest* request) const { |
| 593 if (ShouldLoadFromDisk()) { | 598 if (ShouldLoadFromDisk()) { |
| 594 FilePath path; | 599 FilePath path; |
| 595 if (IsSupportedURL(request->url(), &path)) | 600 if (IsSupportedURL(request->url(), &path)) |
| 596 return new net::URLRequestFileJob(request, path); | 601 return new net::URLRequestFileJob(request, path, network_delegate_); |
| 597 } | 602 } |
| 598 | 603 |
| 599 return new URLRequestChromeJob(request, backend_); | 604 return new URLRequestChromeJob(request, backend_); |
| 600 } | 605 } |
| 601 | 606 |
| 602 } // namespace | 607 } // namespace |
| 603 | 608 |
| 604 net::URLRequestJobFactory::ProtocolHandler* | 609 net::URLRequestJobFactory::ProtocolHandler* |
| 605 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend) { | 610 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend, |
| 606 return new DevToolsJobFactory(backend); | 611 net::NetworkDelegate* network_delegate) { |
| 612 return new DevToolsJobFactory(backend, network_delegate); |
| 607 } | 613 } |
| OLD | NEW |