| 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( |
| 108 content::ResourceContext* resource_context, | 111 net::URLRequest* request, |
| 109 const GURL& url, | |
| 110 const std::string& mime_type, | 112 const std::string& mime_type, |
| 111 GURL* origin, | 113 GURL* origin, |
| 112 std::string* target_id); | 114 std::string* payload); |
| 113 | 115 |
| 114 // Informs the delegate that a Stream was created. |target_id| will be filled | 116 // Informs the delegate that a Stream was created. The Stream can be read from |
| 115 // with the parameter returned by ShouldInterceptResourceAsStream(). The | 117 // 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( | 118 virtual void OnStreamCreated( |
| 119 content::ResourceContext* resource_context, | 119 net::URLRequest* request, |
| 120 int render_process_id, | 120 scoped_ptr<content::StreamHandle> stream); |
| 121 int render_view_id, | |
| 122 const std::string& target_id, | |
| 123 scoped_ptr<StreamHandle> stream, | |
| 124 int64 expected_content_size); | |
| 125 | 121 |
| 126 // Informs the delegate that a response has started. | 122 // Informs the delegate that a response has started. |
| 127 virtual void OnResponseStarted( | 123 virtual void OnResponseStarted( |
| 128 net::URLRequest* request, | 124 net::URLRequest* request, |
| 129 ResourceContext* resource_context, | 125 ResourceContext* resource_context, |
| 130 ResourceResponse* response, | 126 ResourceResponse* response, |
| 131 IPC::Sender* sender); | 127 IPC::Sender* sender); |
| 132 | 128 |
| 133 // Informs the delegate that a request has been redirected. | 129 // Informs the delegate that a request has been redirected. |
| 134 virtual void OnRequestRedirected( | 130 virtual void OnRequestRedirected( |
| 135 const GURL& redirect_url, | 131 const GURL& redirect_url, |
| 136 net::URLRequest* request, | 132 net::URLRequest* request, |
| 137 ResourceContext* resource_context, | 133 ResourceContext* resource_context, |
| 138 ResourceResponse* response); | 134 ResourceResponse* response); |
| 139 | 135 |
| 140 // Notification that a request has completed. | 136 // Notification that a request has completed. |
| 141 virtual void RequestComplete(net::URLRequest* url_request); | 137 virtual void RequestComplete(net::URLRequest* url_request); |
| 142 | 138 |
| 143 protected: | 139 protected: |
| 144 ResourceDispatcherHostDelegate(); | 140 ResourceDispatcherHostDelegate(); |
| 145 virtual ~ResourceDispatcherHostDelegate(); | 141 virtual ~ResourceDispatcherHostDelegate(); |
| 146 }; | 142 }; |
| 147 | 143 |
| 148 } // namespace content | 144 } // namespace content |
| 149 | 145 |
| 150 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 146 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
| OLD | NEW |