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_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Used by StartDataRequest so that the child class can return the data when | 42 // Used by StartDataRequest so that the child class can return the data when |
43 // it's available. | 43 // it's available. |
44 typedef base::Callback<void(base::RefCountedMemory*)> GotDataCallback; | 44 typedef base::Callback<void(base::RefCountedMemory*)> GotDataCallback; |
45 | 45 |
46 // Called by URLDataSource to request data at |path|. The string parameter is | 46 // Called by URLDataSource to request data at |path|. The string parameter is |
47 // the path of the request. The child class should run |callback| when the | 47 // the path of the request. The child class should run |callback| when the |
48 // data is available or if the request could not be satisfied. This can be | 48 // data is available or if the request could not be satisfied. This can be |
49 // called either in this callback or asynchronously with the response. | 49 // called either in this callback or asynchronously with the response. |
50 virtual void StartDataRequest(const std::string& path, | 50 virtual void StartDataRequest(const std::string& path, |
51 bool is_incognito, | 51 int render_process_id, |
| 52 int render_view_id, |
52 const GotDataCallback& callback) = 0; | 53 const GotDataCallback& callback) = 0; |
53 | 54 |
54 // Return the mimetype that should be sent with this response, or empty | 55 // Return the mimetype that should be sent with this response, or empty |
55 // string to specify no mime type. | 56 // string to specify no mime type. |
56 virtual std::string GetMimeType(const std::string& path) const = 0; | 57 virtual std::string GetMimeType(const std::string& path) const = 0; |
57 | 58 |
58 // The following methods are all called on the IO thread. | 59 // The following methods are all called on the IO thread. |
59 | 60 |
60 // Returns the MessageLoop on which the delegate wishes to have | 61 // Returns the MessageLoop on which the delegate wishes to have |
61 // StartDataRequest called to handle the request for |path|. The default | 62 // StartDataRequest called to handle the request for |path|. The default |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // By default, the "X-Frame-Options: DENY" header is sent. To stop this from | 100 // By default, the "X-Frame-Options: DENY" header is sent. To stop this from |
100 // happening, return false. It is OK to return false as needed. | 101 // happening, return false. It is OK to return false as needed. |
101 virtual bool ShouldDenyXFrameOptions() const; | 102 virtual bool ShouldDenyXFrameOptions() const; |
102 | 103 |
103 // By default, only chrome: and chrome-devtools: requests are allowed. | 104 // By default, only chrome: and chrome-devtools: requests are allowed. |
104 // Override in specific WebUI data sources to enable for additional schemes or | 105 // Override in specific WebUI data sources to enable for additional schemes or |
105 // to implement fancier access control. Typically used in concert with | 106 // to implement fancier access control. Typically used in concert with |
106 // ContentBrowserClient::GetAdditionalWebUISchemes() to permit additional | 107 // ContentBrowserClient::GetAdditionalWebUISchemes() to permit additional |
107 // WebUI scheme support for an embedder. | 108 // WebUI scheme support for an embedder. |
108 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; | 109 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; |
| 110 |
| 111 // Called to inform the source that StartDataRequest() will be called soon. |
| 112 // Gives the source an opportunity to rewrite |path| to incorporate extra |
| 113 // information from the URLRequest prior to serving. |
| 114 virtual void WillServiceRequest( |
| 115 const net::URLRequest* request, |
| 116 std::string* path) const {} |
109 }; | 117 }; |
110 | 118 |
111 } // namespace content | 119 } // namespace content |
112 | 120 |
113 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ | 121 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
OLD | NEW |