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 25 matching lines...) Expand all Loading... | |
36 | 36 |
37 // The name of this source. | 37 // The name of this source. |
38 // E.g., for favicons, this could be "favicon", which results in paths for | 38 // E.g., for favicons, this could be "favicon", which results in paths for |
39 // specific resources like "favicon/34" getting sent to this source. | 39 // specific resources like "favicon/34" getting sent to this source. |
40 virtual std::string GetSource() = 0; | 40 virtual std::string GetSource() = 0; |
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 // Request fields passed to StartDataRequest in addition to the path. | |
47 struct ExtraRequestInfo { | |
48 bool is_incognito; | |
49 int render_process_id; | |
50 int render_view_id; | |
51 }; | |
52 | |
46 // Called by URLDataSource to request data at |path|. The string parameter is | 53 // 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 | 54 // 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 | 55 // 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. | 56 // called either in this callback or asynchronously with the response. |
50 virtual void StartDataRequest(const std::string& path, | 57 virtual void StartDataRequest(const std::string& path, |
51 bool is_incognito, | 58 const ExtraRequestInfo& info, |
jam
2013/04/16 23:15:30
Per the conventions for the Content API (http://ww
Jered
2013/04/16 23:48:15
One of the callees who wants to check is_incognito
| |
52 const GotDataCallback& callback) = 0; | 59 const GotDataCallback& callback) = 0; |
53 | 60 |
54 // Return the mimetype that should be sent with this response, or empty | 61 // Return the mimetype that should be sent with this response, or empty |
55 // string to specify no mime type. | 62 // string to specify no mime type. |
56 virtual std::string GetMimeType(const std::string& path) const = 0; | 63 virtual std::string GetMimeType(const std::string& path) const = 0; |
57 | 64 |
58 // The following methods are all called on the IO thread. | 65 // The following methods are all called on the IO thread. |
59 | 66 |
60 // Returns the MessageLoop on which the delegate wishes to have | 67 // Returns the MessageLoop on which the delegate wishes to have |
61 // StartDataRequest called to handle the request for |path|. The default | 68 // StartDataRequest called to handle the request for |path|. The default |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 // Override in specific WebUI data sources to enable for additional schemes or | 111 // Override in specific WebUI data sources to enable for additional schemes or |
105 // to implement fancier access control. Typically used in concert with | 112 // to implement fancier access control. Typically used in concert with |
106 // ContentBrowserClient::GetAdditionalWebUISchemes() to permit additional | 113 // ContentBrowserClient::GetAdditionalWebUISchemes() to permit additional |
107 // WebUI scheme support for an embedder. | 114 // WebUI scheme support for an embedder. |
108 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; | 115 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; |
109 }; | 116 }; |
110 | 117 |
111 } // namespace content | 118 } // namespace content |
112 | 119 |
113 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ | 120 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
OLD | NEW |