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" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
12 #include "webkit/glue/resource_type.h" | 13 #include "webkit/glue/resource_type.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 template <class T> class ScopedVector; | 16 template <class T> class ScopedVector; |
16 | 17 |
17 namespace appcache { | 18 namespace appcache { |
18 class AppCacheService; | 19 class AppCacheService; |
19 } | 20 } |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class ResourceContext; | 23 class ResourceContext; |
23 class ResourceThrottle; | 24 class ResourceThrottle; |
| 25 class StreamHandle; |
24 struct Referrer; | 26 struct Referrer; |
25 struct ResourceResponse; | 27 struct ResourceResponse; |
26 } | 28 } |
27 | 29 |
28 namespace IPC { | 30 namespace IPC { |
29 class Sender; | 31 class Sender; |
30 } | 32 } |
31 | 33 |
32 namespace net { | 34 namespace net { |
33 class AuthChallengeInfo; | 35 class AuthChallengeInfo; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // guarantee that the app successfully handled it. | 102 // guarantee that the app successfully handled it. |
101 virtual bool HandleExternalProtocol(const GURL& url, | 103 virtual bool HandleExternalProtocol(const GURL& url, |
102 int child_id, | 104 int child_id, |
103 int route_id); | 105 int route_id); |
104 | 106 |
105 // Returns true if we should force the given resource to be downloaded. | 107 // Returns true if we should force the given resource to be downloaded. |
106 // Otherwise, the content layer decides. | 108 // Otherwise, the content layer decides. |
107 virtual bool ShouldForceDownloadResource( | 109 virtual bool ShouldForceDownloadResource( |
108 const GURL& url, const std::string& mime_type); | 110 const GURL& url, const std::string& mime_type); |
109 | 111 |
| 112 // Returns true and sets |security_origin| and |target_id| if a Stream should |
| 113 // be created for the resource. |
| 114 // If true is returned, a new Stream will be created and OnStreamCreated will |
| 115 // be called with the |target_id| returned by this function and a URL to read |
| 116 // the Stream which is accessible from the |security_origin| returned by this |
| 117 // function. |
| 118 virtual bool ShouldInterceptResourceAsStream( |
| 119 content::ResourceContext* resource_context, |
| 120 const GURL& url, |
| 121 const std::string& mime_type, |
| 122 GURL* security_origin, |
| 123 std::string* target_id); |
| 124 |
| 125 // Informs the delegate that a stream was created. |target_id| will be filled |
| 126 // with the parameter returned by ShouldInterceptResourceAsStream(). The |
| 127 // Stream can be read from the blob URL owned by |stream|, but can only be |
| 128 // read once. |
| 129 virtual void OnStreamCreated( |
| 130 content::ResourceContext* resource_context, |
| 131 int render_process_id, |
| 132 int render_view_id, |
| 133 const std::string& target_id, |
| 134 scoped_ptr<StreamHandle> stream); |
| 135 |
110 // Informs the delegate that a response has started. | 136 // Informs the delegate that a response has started. |
111 virtual void OnResponseStarted( | 137 virtual void OnResponseStarted( |
112 net::URLRequest* request, | 138 net::URLRequest* request, |
113 ResourceContext* resource_context, | 139 ResourceContext* resource_context, |
114 ResourceResponse* response, | 140 ResourceResponse* response, |
115 IPC::Sender* sender); | 141 IPC::Sender* sender); |
116 | 142 |
117 // Informs the delegate that a request has been redirected. | 143 // Informs the delegate that a request has been redirected. |
118 virtual void OnRequestRedirected( | 144 virtual void OnRequestRedirected( |
119 const GURL& redirect_url, | 145 const GURL& redirect_url, |
120 net::URLRequest* request, | 146 net::URLRequest* request, |
121 ResourceContext* resource_context, | 147 ResourceContext* resource_context, |
122 ResourceResponse* response); | 148 ResourceResponse* response); |
123 | 149 |
124 protected: | 150 protected: |
125 ResourceDispatcherHostDelegate(); | 151 ResourceDispatcherHostDelegate(); |
126 virtual ~ResourceDispatcherHostDelegate(); | 152 virtual ~ResourceDispatcherHostDelegate(); |
127 }; | 153 }; |
128 | 154 |
129 } // namespace content | 155 } // namespace content |
130 | 156 |
131 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 157 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
OLD | NEW |