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" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 class URLRequestChromeJob : public net::URLRequestJob, | 99 class URLRequestChromeJob : public net::URLRequestJob, |
100 public base::SupportsWeakPtr<URLRequestChromeJob> { | 100 public base::SupportsWeakPtr<URLRequestChromeJob> { |
101 public: | 101 public: |
102 // |is_incognito| set when job is generated from an incognito profile. | 102 // |is_incognito| set when job is generated from an incognito profile. |
103 URLRequestChromeJob(net::URLRequest* request, | 103 URLRequestChromeJob(net::URLRequest* request, |
104 net::NetworkDelegate* network_delegate, | 104 net::NetworkDelegate* network_delegate, |
105 URLDataManagerBackend* backend, | 105 URLDataManagerBackend* backend, |
106 bool is_incognito); | 106 bool is_incognito); |
107 | 107 |
108 // net::URLRequestJob implementation. | 108 // net::URLRequestJob implementation. |
109 virtual void Start() OVERRIDE; | 109 virtual void Start() override; |
110 virtual void Kill() OVERRIDE; | 110 virtual void Kill() override; |
111 virtual bool ReadRawData(net::IOBuffer* buf, | 111 virtual bool ReadRawData(net::IOBuffer* buf, |
112 int buf_size, | 112 int buf_size, |
113 int* bytes_read) OVERRIDE; | 113 int* bytes_read) override; |
114 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 114 virtual bool GetMimeType(std::string* mime_type) const override; |
115 virtual int GetResponseCode() const OVERRIDE; | 115 virtual int GetResponseCode() const override; |
116 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; | 116 virtual void GetResponseInfo(net::HttpResponseInfo* info) override; |
117 | 117 |
118 // Used to notify that the requested data's |mime_type| is ready. | 118 // Used to notify that the requested data's |mime_type| is ready. |
119 void MimeTypeAvailable(const std::string& mime_type); | 119 void MimeTypeAvailable(const std::string& mime_type); |
120 | 120 |
121 // Called by ChromeURLDataManager to notify us that the data blob is ready | 121 // Called by ChromeURLDataManager to notify us that the data blob is ready |
122 // for us. | 122 // for us. |
123 void DataAvailable(base::RefCountedMemory* bytes); | 123 void DataAvailable(base::RefCountedMemory* bytes); |
124 | 124 |
125 void set_mime_type(const std::string& mime_type) { | 125 void set_mime_type(const std::string& mime_type) { |
126 mime_type_ = mime_type; | 126 mime_type_ = mime_type; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 AppCacheServiceImpl* appcache_service, | 429 AppCacheServiceImpl* appcache_service, |
430 ChromeBlobStorageContext* blob_storage_context) | 430 ChromeBlobStorageContext* blob_storage_context) |
431 : resource_context_(resource_context), | 431 : resource_context_(resource_context), |
432 is_incognito_(is_incognito), | 432 is_incognito_(is_incognito), |
433 appcache_service_(appcache_service), | 433 appcache_service_(appcache_service), |
434 blob_storage_context_(blob_storage_context) {} | 434 blob_storage_context_(blob_storage_context) {} |
435 virtual ~ChromeProtocolHandler() {} | 435 virtual ~ChromeProtocolHandler() {} |
436 | 436 |
437 virtual net::URLRequestJob* MaybeCreateJob( | 437 virtual net::URLRequestJob* MaybeCreateJob( |
438 net::URLRequest* request, | 438 net::URLRequest* request, |
439 net::NetworkDelegate* network_delegate) const OVERRIDE { | 439 net::NetworkDelegate* network_delegate) const override { |
440 DCHECK(request); | 440 DCHECK(request); |
441 | 441 |
442 // Check for chrome://view-http-cache/*, which uses its own job type. | 442 // Check for chrome://view-http-cache/*, which uses its own job type. |
443 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) | 443 if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) |
444 return ViewHttpCacheJobFactory::CreateJobForRequest(request, | 444 return ViewHttpCacheJobFactory::CreateJobForRequest(request, |
445 network_delegate); | 445 network_delegate); |
446 | 446 |
447 // Next check for chrome://appcache-internals/, which uses its own job type. | 447 // Next check for chrome://appcache-internals/, which uses its own job type. |
448 if (request->url().SchemeIs(kChromeUIScheme) && | 448 if (request->url().SchemeIs(kChromeUIScheme) && |
449 request->url().host() == kChromeUIAppCacheInternalsHost) { | 449 request->url().host() == kChromeUIAppCacheInternalsHost) { |
(...skipping 20 matching lines...) Expand all Loading... |
470 request->url().host() == kChromeUIHistogramHost) { | 470 request->url().host() == kChromeUIHistogramHost) { |
471 return new HistogramInternalsRequestJob(request, network_delegate); | 471 return new HistogramInternalsRequestJob(request, network_delegate); |
472 } | 472 } |
473 | 473 |
474 // Fall back to using a custom handler | 474 // Fall back to using a custom handler |
475 return new URLRequestChromeJob( | 475 return new URLRequestChromeJob( |
476 request, network_delegate, | 476 request, network_delegate, |
477 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); | 477 GetURLDataManagerForResourceContext(resource_context_), is_incognito_); |
478 } | 478 } |
479 | 479 |
480 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { | 480 virtual bool IsSafeRedirectTarget(const GURL& location) const override { |
481 return false; | 481 return false; |
482 } | 482 } |
483 | 483 |
484 private: | 484 private: |
485 // These members are owned by ProfileIOData, which owns this ProtocolHandler. | 485 // These members are owned by ProfileIOData, which owns this ProtocolHandler. |
486 content::ResourceContext* const resource_context_; | 486 content::ResourceContext* const resource_context_; |
487 | 487 |
488 // True when generated from an incognito profile. | 488 // True when generated from an incognito profile. |
489 const bool is_incognito_; | 489 const bool is_incognito_; |
490 AppCacheServiceImpl* appcache_service_; | 490 AppCacheServiceImpl* appcache_service_; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 class DevToolsJobFactory | 690 class DevToolsJobFactory |
691 : public net::URLRequestJobFactory::ProtocolHandler { | 691 : public net::URLRequestJobFactory::ProtocolHandler { |
692 public: | 692 public: |
693 // |is_incognito| should be set for incognito profiles. | 693 // |is_incognito| should be set for incognito profiles. |
694 DevToolsJobFactory(content::ResourceContext* resource_context, | 694 DevToolsJobFactory(content::ResourceContext* resource_context, |
695 bool is_incognito); | 695 bool is_incognito); |
696 virtual ~DevToolsJobFactory(); | 696 virtual ~DevToolsJobFactory(); |
697 | 697 |
698 virtual net::URLRequestJob* MaybeCreateJob( | 698 virtual net::URLRequestJob* MaybeCreateJob( |
699 net::URLRequest* request, | 699 net::URLRequest* request, |
700 net::NetworkDelegate* network_delegate) const OVERRIDE; | 700 net::NetworkDelegate* network_delegate) const override; |
701 | 701 |
702 private: | 702 private: |
703 // |resource_context_| and |network_delegate_| are owned by ProfileIOData, | 703 // |resource_context_| and |network_delegate_| are owned by ProfileIOData, |
704 // which owns this ProtocolHandler. | 704 // which owns this ProtocolHandler. |
705 content::ResourceContext* const resource_context_; | 705 content::ResourceContext* const resource_context_; |
706 | 706 |
707 // True when generated from an incognito profile. | 707 // True when generated from an incognito profile. |
708 const bool is_incognito_; | 708 const bool is_incognito_; |
709 | 709 |
710 DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory); | 710 DISALLOW_COPY_AND_ASSIGN(DevToolsJobFactory); |
(...skipping 19 matching lines...) Expand all Loading... |
730 | 730 |
731 } // namespace | 731 } // namespace |
732 | 732 |
733 net::URLRequestJobFactory::ProtocolHandler* | 733 net::URLRequestJobFactory::ProtocolHandler* |
734 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, | 734 CreateDevToolsProtocolHandler(content::ResourceContext* resource_context, |
735 bool is_incognito) { | 735 bool is_incognito) { |
736 return new DevToolsJobFactory(resource_context, is_incognito); | 736 return new DevToolsJobFactory(resource_context, is_incognito); |
737 } | 737 } |
738 | 738 |
739 } // namespace content | 739 } // namespace content |
OLD | NEW |