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 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 // Returns true if we should force the given resource to be downloaded. | 94 // Returns true if we should force the given resource to be downloaded. |
95 // Otherwise, the content layer decides. | 95 // Otherwise, the content layer decides. |
96 virtual bool ShouldForceDownloadResource( | 96 virtual bool ShouldForceDownloadResource( |
97 const GURL& url, const std::string& mime_type); | 97 const GURL& url, const std::string& mime_type); |
98 | 98 |
99 // Returns true and sets |origin| and |target_id| if a Stream should be | 99 // Returns true and sets |origin| and |target_id| if a Stream should be |
100 // created for the resource. | 100 // created for the resource. |
101 // If true is returned, a new Stream will be created and OnStreamCreated() | 101 // If true is returned, a new Stream will be created and OnStreamCreated() |
102 // will be called with | 102 // will be called with |
103 // - the |target_id| returned by this function | 103 // - the |target_id| returned by this function |
104 // - If the stream will be rendered in a BrowserPlugin, |view_id| will | |
105 // contain a GUID that can be used to uniquely identify it. | |
104 // - a StreamHandle instance for the Stream. The handle contains the URL for | 106 // - a StreamHandle instance for the Stream. The handle contains the URL for |
105 // reading the Stream etc. | 107 // reading the Stream etc. |
106 // The Stream's origin will be set to |origin|. | 108 // The Stream's origin will be set to |origin|. |
109 // | |
110 // If the stream will be rendered in a BrowserPlugin, |payload| will contain | |
111 // the data that should be given to the old ResourceHandler to forward to the | |
112 // renderer process. | |
107 virtual bool ShouldInterceptResourceAsStream( | 113 virtual bool ShouldInterceptResourceAsStream( |
108 content::ResourceContext* resource_context, | 114 content::ResourceContext* resource_context, |
109 const GURL& url, | 115 const GURL& url, |
110 const std::string& mime_type, | 116 const std::string& mime_type, |
111 GURL* origin, | 117 GURL* origin, |
112 std::string* target_id); | 118 std::string* target_id, |
119 std::string* payload, | |
120 std::string* view_id); | |
jam
2014/05/30 23:04:16
if my reading is correct, content calls chrome wit
Zachary Kuznia
2014/05/30 23:40:55
None of the other parameters are guaranteed to be
jam
2014/06/02 06:41:53
I see. Ok, since I'd really like to avoid this ext
Zachary Kuznia
2014/06/05 22:28:22
Done.
| |
113 | 121 |
114 // Informs the delegate that a Stream was created. |target_id| will be filled | 122 // Informs the delegate that a Stream was created. |target_id| will be filled |
115 // with the parameter returned by ShouldInterceptResourceAsStream(). The | 123 // with the parameter returned by ShouldInterceptResourceAsStream(). The |
116 // Stream can be read from the blob URL of the Stream, but can only be read | 124 // Stream can be read from the blob URL of the Stream, but can only be read |
117 // once. | 125 // once. |
118 virtual void OnStreamCreated( | 126 virtual void OnStreamCreated( |
119 content::ResourceContext* resource_context, | 127 content::ResourceContext* resource_context, |
120 int render_process_id, | 128 int render_process_id, |
121 int render_view_id, | 129 int render_view_id, |
122 const std::string& target_id, | 130 const std::string& target_id, |
131 const std::string& view_id, | |
123 scoped_ptr<StreamHandle> stream, | 132 scoped_ptr<StreamHandle> stream, |
124 int64 expected_content_size); | 133 int64 expected_content_size); |
125 | 134 |
126 // Informs the delegate that a response has started. | 135 // Informs the delegate that a response has started. |
127 virtual void OnResponseStarted( | 136 virtual void OnResponseStarted( |
128 net::URLRequest* request, | 137 net::URLRequest* request, |
129 ResourceContext* resource_context, | 138 ResourceContext* resource_context, |
130 ResourceResponse* response, | 139 ResourceResponse* response, |
131 IPC::Sender* sender); | 140 IPC::Sender* sender); |
132 | 141 |
133 // Informs the delegate that a request has been redirected. | 142 // Informs the delegate that a request has been redirected. |
134 virtual void OnRequestRedirected( | 143 virtual void OnRequestRedirected( |
135 const GURL& redirect_url, | 144 const GURL& redirect_url, |
136 net::URLRequest* request, | 145 net::URLRequest* request, |
137 ResourceContext* resource_context, | 146 ResourceContext* resource_context, |
138 ResourceResponse* response); | 147 ResourceResponse* response); |
139 | 148 |
140 // Notification that a request has completed. | 149 // Notification that a request has completed. |
141 virtual void RequestComplete(net::URLRequest* url_request); | 150 virtual void RequestComplete(net::URLRequest* url_request); |
142 | 151 |
143 protected: | 152 protected: |
144 ResourceDispatcherHostDelegate(); | 153 ResourceDispatcherHostDelegate(); |
145 virtual ~ResourceDispatcherHostDelegate(); | 154 virtual ~ResourceDispatcherHostDelegate(); |
146 }; | 155 }; |
147 | 156 |
148 } // namespace content | 157 } // namespace content |
149 | 158 |
150 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 159 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
OLD | NEW |