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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 virtual bool HandleExternalProtocol(const GURL& url, | 89 virtual bool HandleExternalProtocol(const GURL& url, |
90 int child_id, | 90 int child_id, |
91 int route_id, | 91 int route_id, |
92 bool initiated_by_user_gesture); | 92 bool initiated_by_user_gesture); |
93 | 93 |
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| if a Stream should be created for the |
100 // created for the resource. | 100 // 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 | |
104 // - a StreamHandle instance for the Stream. The handle contains the URL for | 103 // - a StreamHandle instance for the Stream. The handle contains the URL for |
105 // reading the Stream etc. | 104 // reading the Stream etc. |
106 // The Stream's origin will be set to |origin|. | 105 // The Stream's origin will be set to |origin|. |
106 // | |
107 // If the stream will be rendered in a BrowserPlugin, |payload| will contain | |
108 // the data that should be given to the old ResourceHandler to forward to the | |
109 // renderer process. | |
107 virtual bool ShouldInterceptResourceAsStream( | 110 virtual bool ShouldInterceptResourceAsStream( |
111 net::URLRequest* request, | |
108 content::ResourceContext* resource_context, | 112 content::ResourceContext* resource_context, |
jam
2014/06/06 15:00:40
nit: don't pass this as it's available from Resour
Zachary Kuznia
2014/06/07 01:45:37
Done.
| |
109 const GURL& url, | |
110 const std::string& mime_type, | 113 const std::string& mime_type, |
111 GURL* origin, | 114 GURL* origin, |
112 std::string* target_id); | 115 std::string* payload); |
113 | 116 |
114 // Informs the delegate that a Stream was created. |target_id| will be filled | 117 // Informs the delegate that a Stream was created. The Stream can be read from |
115 // with the parameter returned by ShouldInterceptResourceAsStream(). The | 118 // the blob URL of the Stream, but can only be read once. |
116 // Stream can be read from the blob URL of the Stream, but can only be read | |
117 // once. | |
118 virtual void OnStreamCreated( | 119 virtual void OnStreamCreated( |
120 net::URLRequest* request, | |
119 content::ResourceContext* resource_context, | 121 content::ResourceContext* resource_context, |
120 int render_process_id, | 122 int render_process_id, |
121 int render_view_id, | 123 int render_view_id, |
jam
2014/06/06 15:00:40
ditto for the above three parameters
Zachary Kuznia
2014/06/07 01:45:37
Done.
| |
122 const std::string& target_id, | 124 scoped_ptr<content::StreamHandle> stream); |
123 scoped_ptr<StreamHandle> stream, | |
124 int64 expected_content_size); | |
125 | 125 |
126 // Informs the delegate that a response has started. | 126 // Informs the delegate that a response has started. |
127 virtual void OnResponseStarted( | 127 virtual void OnResponseStarted( |
128 net::URLRequest* request, | 128 net::URLRequest* request, |
129 ResourceContext* resource_context, | 129 ResourceContext* resource_context, |
130 ResourceResponse* response, | 130 ResourceResponse* response, |
131 IPC::Sender* sender); | 131 IPC::Sender* sender); |
132 | 132 |
133 // Informs the delegate that a request has been redirected. | 133 // Informs the delegate that a request has been redirected. |
134 virtual void OnRequestRedirected( | 134 virtual void OnRequestRedirected( |
135 const GURL& redirect_url, | 135 const GURL& redirect_url, |
136 net::URLRequest* request, | 136 net::URLRequest* request, |
137 ResourceContext* resource_context, | 137 ResourceContext* resource_context, |
138 ResourceResponse* response); | 138 ResourceResponse* response); |
139 | 139 |
140 // Notification that a request has completed. | 140 // Notification that a request has completed. |
141 virtual void RequestComplete(net::URLRequest* url_request); | 141 virtual void RequestComplete(net::URLRequest* url_request); |
142 | 142 |
143 protected: | 143 protected: |
144 ResourceDispatcherHostDelegate(); | 144 ResourceDispatcherHostDelegate(); |
145 virtual ~ResourceDispatcherHostDelegate(); | 145 virtual ~ResourceDispatcherHostDelegate(); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace content | 148 } // namespace content |
149 | 149 |
150 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 150 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
OLD | NEW |