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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // guarantee that the app successfully handled it. | 101 // guarantee that the app successfully handled it. |
102 virtual bool HandleExternalProtocol(const GURL& url, | 102 virtual bool HandleExternalProtocol(const GURL& url, |
103 int child_id, | 103 int child_id, |
104 int route_id); | 104 int route_id); |
105 | 105 |
106 // Returns true if we should force the given resource to be downloaded. | 106 // Returns true if we should force the given resource to be downloaded. |
107 // Otherwise, the content layer decides. | 107 // Otherwise, the content layer decides. |
108 virtual bool ShouldForceDownloadResource( | 108 virtual bool ShouldForceDownloadResource( |
109 const GURL& url, const std::string& mime_type); | 109 const GURL& url, const std::string& mime_type); |
110 | 110 |
111 // Returns true and sets |security_origin| and |target_id| if a Stream should | 111 // Returns true and sets |origin| and |target_id| if a Stream should be |
112 // be created for the resource. | 112 // created for the resource. |
113 // If true is returned, a new Stream will be created and OnStreamCreated will | 113 // If true is returned, a new Stream will be created and OnStreamCreated() |
114 // be called with the |target_id| returned by this function and a URL to read | 114 // will be called with |
115 // the Stream which is accessible from the |security_origin| returned by this | 115 // - the |target_id| returned by this function |
116 // function. | 116 // - a StreamHandle instance for the Stream. The handle contains the URL for |
| 117 // reading the Stream etc. |
| 118 // The Stream's origin will be set to |origin|. |
117 virtual bool ShouldInterceptResourceAsStream( | 119 virtual bool ShouldInterceptResourceAsStream( |
118 content::ResourceContext* resource_context, | 120 content::ResourceContext* resource_context, |
119 const GURL& url, | 121 const GURL& url, |
120 const std::string& mime_type, | 122 const std::string& mime_type, |
121 GURL* security_origin, | 123 GURL* origin, |
122 std::string* target_id); | 124 std::string* target_id); |
123 | 125 |
124 // Informs the delegate that a stream was created. |target_id| will be filled | 126 // Informs the delegate that a Stream was created. |target_id| will be filled |
125 // with the parameter returned by ShouldInterceptResourceAsStream(). The | 127 // with the parameter returned by ShouldInterceptResourceAsStream(). The |
126 // Stream can be read from the blob URL owned by |stream|, but can only be | 128 // Stream can be read from the blob URL of the Stream, but can only be read |
127 // read once. | 129 // once. |
128 virtual void OnStreamCreated( | 130 virtual void OnStreamCreated( |
129 content::ResourceContext* resource_context, | 131 content::ResourceContext* resource_context, |
130 int render_process_id, | 132 int render_process_id, |
131 int render_view_id, | 133 int render_view_id, |
132 const std::string& target_id, | 134 const std::string& target_id, |
133 scoped_ptr<StreamHandle> stream, | 135 scoped_ptr<StreamHandle> stream, |
134 int64 expected_content_size); | 136 int64 expected_content_size); |
135 | 137 |
136 // Informs the delegate that a response has started. | 138 // Informs the delegate that a response has started. |
137 virtual void OnResponseStarted( | 139 virtual void OnResponseStarted( |
(...skipping 10 matching lines...) Expand all Loading... |
148 ResourceResponse* response); | 150 ResourceResponse* response); |
149 | 151 |
150 protected: | 152 protected: |
151 ResourceDispatcherHostDelegate(); | 153 ResourceDispatcherHostDelegate(); |
152 virtual ~ResourceDispatcherHostDelegate(); | 154 virtual ~ResourceDispatcherHostDelegate(); |
153 }; | 155 }; |
154 | 156 |
155 } // namespace content | 157 } // namespace content |
156 | 158 |
157 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 159 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
OLD | NEW |