| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 PendingRequestMap::iterator i = pending_requests_.find(request_id); | 559 PendingRequestMap::iterator i = pending_requests_.find(request_id); |
| 560 if (i != pending_requests_.end()) { | 560 if (i != pending_requests_.end()) { |
| 561 URLRequestChromeJob* job(i->second); | 561 URLRequestChromeJob* job(i->second); |
| 562 pending_requests_.erase(i); | 562 pending_requests_.erase(i); |
| 563 job->DataAvailable(bytes); | 563 job->DataAvailable(bytes); |
| 564 } | 564 } |
| 565 } | 565 } |
| 566 | 566 |
| 567 namespace { | 567 namespace { |
| 568 | 568 |
| 569 #if defined(DEBUG_DEVTOOLS) |
| 569 bool IsSupportedDevToolsURL(const GURL& url, FilePath* path) { | 570 bool IsSupportedDevToolsURL(const GURL& url, FilePath* path) { |
| 570 if (!url.SchemeIs(chrome::kChromeDevToolsScheme)) | 571 if (!url.SchemeIs(chrome::kChromeDevToolsScheme)) |
| 571 return false; | 572 return false; |
| 572 | 573 |
| 573 if (!url.is_valid()) { | 574 if (!url.is_valid()) { |
| 574 NOTREACHED(); | 575 NOTREACHED(); |
| 575 return false; | 576 return false; |
| 576 } | 577 } |
| 577 | 578 |
| 578 // Remove Query and Ref from URL. | 579 // Remove Query and Ref from URL. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 599 FilePath inspector_dir; | 600 FilePath inspector_dir; |
| 600 if (!PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) | 601 if (!PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) |
| 601 return false; | 602 return false; |
| 602 | 603 |
| 603 if (inspector_dir.empty()) | 604 if (inspector_dir.empty()) |
| 604 return false; | 605 return false; |
| 605 | 606 |
| 606 *path = inspector_dir.AppendASCII(relative_path); | 607 *path = inspector_dir.AppendASCII(relative_path); |
| 607 return true; | 608 return true; |
| 608 } | 609 } |
| 610 #endif // defined(DEBUG_DEVTOOLS) |
| 609 | 611 |
| 610 class DevToolsJobFactory | 612 class DevToolsJobFactory |
| 611 : public net::URLRequestJobFactory::ProtocolHandler { | 613 : public net::URLRequestJobFactory::ProtocolHandler { |
| 612 public: | 614 public: |
| 613 DevToolsJobFactory(ChromeURLDataManagerBackend* backend, | 615 DevToolsJobFactory(ChromeURLDataManagerBackend* backend, |
| 614 net::NetworkDelegate* network_delegate); | 616 net::NetworkDelegate* network_delegate); |
| 615 virtual ~DevToolsJobFactory(); | 617 virtual ~DevToolsJobFactory(); |
| 616 | 618 |
| 617 virtual net::URLRequestJob* MaybeCreateJob( | 619 virtual net::URLRequestJob* MaybeCreateJob( |
| 618 net::URLRequest* request, | 620 net::URLRequest* request, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 647 return new URLRequestChromeJob(request, network_delegate, backend_); | 649 return new URLRequestChromeJob(request, network_delegate, backend_); |
| 648 } | 650 } |
| 649 | 651 |
| 650 } // namespace | 652 } // namespace |
| 651 | 653 |
| 652 net::URLRequestJobFactory::ProtocolHandler* | 654 net::URLRequestJobFactory::ProtocolHandler* |
| 653 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend, | 655 CreateDevToolsProtocolHandler(ChromeURLDataManagerBackend* backend, |
| 654 net::NetworkDelegate* network_delegate) { | 656 net::NetworkDelegate* network_delegate) { |
| 655 return new DevToolsJobFactory(backend, network_delegate); | 657 return new DevToolsJobFactory(backend, network_delegate); |
| 656 } | 658 } |
| OLD | NEW |