| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 | 12 |
| 13 class MessageLoop; | 13 class MessageLoop; |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class RefCountedMemory; | 16 class RefCountedMemory; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { |
| 20 class URLRequest; |
| 21 } |
| 22 |
| 19 namespace content { | 23 namespace content { |
| 20 class BrowserContext; | 24 class BrowserContext; |
| 21 | 25 |
| 22 // A URLDataSource is an object that can answer requests for data | 26 // A URLDataSource is an object that can answer requests for data |
| 23 // asynchronously. An implementation of URLDataSource should handle calls to | 27 // asynchronously. An implementation of URLDataSource should handle calls to |
| 24 // StartDataRequest() by starting its (implementation-specific) asynchronous | 28 // StartDataRequest() by starting its (implementation-specific) asynchronous |
| 25 // request for the data, then running the callback given in that method to | 29 // request for the data, then running the callback given in that method to |
| 26 // notify. | 30 // notify. |
| 27 class CONTENT_EXPORT URLDataSource { | 31 class CONTENT_EXPORT URLDataSource { |
| 28 public: | 32 public: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // thereby slightly reducing the protection applied to the page. | 92 // thereby slightly reducing the protection applied to the page. |
| 89 | 93 |
| 90 // By default, "object-src 'none';" is added to CSP. Override to change this. | 94 // By default, "object-src 'none';" is added to CSP. Override to change this. |
| 91 virtual std::string GetContentSecurityPolicyObjectSrc() const; | 95 virtual std::string GetContentSecurityPolicyObjectSrc() const; |
| 92 // By default, "frame-src 'none';" is added to CSP. Override to change this. | 96 // By default, "frame-src 'none';" is added to CSP. Override to change this. |
| 93 virtual std::string GetContentSecurityPolicyFrameSrc() const; | 97 virtual std::string GetContentSecurityPolicyFrameSrc() const; |
| 94 | 98 |
| 95 // By default, the "X-Frame-Options: DENY" header is sent. To stop this from | 99 // By default, the "X-Frame-Options: DENY" header is sent. To stop this from |
| 96 // happening, return false. It is OK to return false as needed. | 100 // happening, return false. It is OK to return false as needed. |
| 97 virtual bool ShouldDenyXFrameOptions() const; | 101 virtual bool ShouldDenyXFrameOptions() const; |
| 102 |
| 103 // By default, only chrome: and chrome-devtools: requests are allowed. |
| 104 // Override in specific data sources to enable for additional schemes or to |
| 105 // implement fancier access control. |
| 106 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; |
| 98 }; | 107 }; |
| 99 | 108 |
| 100 } // namespace content | 109 } // namespace content |
| 101 | 110 |
| 102 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_DELEGATE_H_ | 111 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| OLD | NEW |