| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_WEB_PUBLIC_URL_DATA_SOURCE_IOS_H_ | 5 #ifndef IOS_WEB_PUBLIC_URL_DATA_SOURCE_IOS_H_ |
| 6 #define IOS_WEB_PUBLIC_URL_DATA_SOURCE_IOS_H_ | 6 #define IOS_WEB_PUBLIC_URL_DATA_SOURCE_IOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 | 12 |
| 13 class GURL; |
| 14 |
| 13 namespace base { | 15 namespace base { |
| 14 class RefCountedMemory; | 16 class RefCountedMemory; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace net { | |
| 18 class URLRequest; | |
| 19 } | |
| 20 | |
| 21 namespace web { | 19 namespace web { |
| 22 class BrowserState; | 20 class BrowserState; |
| 23 | 21 |
| 24 // A URLDataSourceIOS is an object that can answer requests for WebUI data | 22 // A URLDataSourceIOS is an object that can answer requests for WebUI data |
| 25 // asynchronously. An implementation of URLDataSourceIOS should handle calls to | 23 // asynchronously. An implementation of URLDataSourceIOS should handle calls to |
| 26 // StartDataRequest() by starting its (implementation-specific) asynchronous | 24 // StartDataRequest() by starting its (implementation-specific) asynchronous |
| 27 // request for the data, then running the callback given in that method to | 25 // request for the data, then running the callback given in that method to |
| 28 // notify. | 26 // notify. |
| 29 class URLDataSourceIOS { | 27 class URLDataSourceIOS { |
| 30 public: | 28 public: |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 75 |
| 78 // By default, the "X-Frame-Options: DENY" header is sent. To stop this from | 76 // By default, the "X-Frame-Options: DENY" header is sent. To stop this from |
| 79 // happening, return false. It is OK to return false as needed. | 77 // happening, return false. It is OK to return false as needed. |
| 80 virtual bool ShouldDenyXFrameOptions() const; | 78 virtual bool ShouldDenyXFrameOptions() const; |
| 81 | 79 |
| 82 // By default, only chrome: requests are allowed. Override in specific WebUI | 80 // By default, only chrome: requests are allowed. Override in specific WebUI |
| 83 // data sources to enable for additional schemes or to implement fancier | 81 // data sources to enable for additional schemes or to implement fancier |
| 84 // access control. Typically used in concert with | 82 // access control. Typically used in concert with |
| 85 // WebClient::GetAdditionalWebUISchemes() to permit additional WebUI scheme | 83 // WebClient::GetAdditionalWebUISchemes() to permit additional WebUI scheme |
| 86 // support for an embedder. | 84 // support for an embedder. |
| 87 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; | 85 virtual bool ShouldServiceRequest(const GURL& url) const; |
| 88 | |
| 89 // Called to inform the source that StartDataRequest() will be called soon. | |
| 90 // Gives the source an opportunity to rewrite |path| to incorporate extra | |
| 91 // information from the URLRequest prior to serving. | |
| 92 virtual void WillServiceRequest(const net::URLRequest* request, | |
| 93 std::string* path) const {} | |
| 94 }; | 86 }; |
| 95 | 87 |
| 96 } // namespace web | 88 } // namespace web |
| 97 | 89 |
| 98 #endif // IOS_WEB_PUBLIC_URL_DATA_SOURCE_IOS_H_ | 90 #endif // IOS_WEB_PUBLIC_URL_DATA_SOURCE_IOS_H_ |
| OLD | NEW |