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/files/file_path.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
13 #include "content/public/common/resource_type.h" | 14 #include "content/public/common/resource_type.h" |
14 #include "ui/base/page_transition_types.h" | 15 #include "ui/base/page_transition_types.h" |
15 | 16 |
16 class GURL; | 17 class GURL; |
17 template <class T> class ScopedVector; | 18 template <class T> class ScopedVector; |
18 | 19 |
19 namespace IPC { | 20 namespace IPC { |
20 class Sender; | 21 class Sender; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 bool is_main_frame, | 80 bool is_main_frame, |
80 ui::PageTransition page_transition, | 81 ui::PageTransition page_transition, |
81 bool has_user_gesture); | 82 bool has_user_gesture); |
82 | 83 |
83 // Returns true if we should force the given resource to be downloaded. | 84 // Returns true if we should force the given resource to be downloaded. |
84 // Otherwise, the content layer decides. | 85 // Otherwise, the content layer decides. |
85 virtual bool ShouldForceDownloadResource(const GURL& url, | 86 virtual bool ShouldForceDownloadResource(const GURL& url, |
86 const std::string& mime_type); | 87 const std::string& mime_type); |
87 | 88 |
88 // Returns true and sets |origin| if a Stream should be created for the | 89 // Returns true and sets |origin| if a Stream should be created for the |
89 // resource. | 90 // resource. |plugin_path| is the plugin which will be used to handle the |
90 // If true is returned, a new Stream will be created and OnStreamCreated() | 91 // request (if the stream will be rendered in a BrowserPlugin). It may be |
91 // will be called with | 92 // empty. If true is returned, a new Stream will be created and |
92 // - a StreamHandle instance for the Stream. The handle contains the URL for | 93 // OnStreamCreated() will be called with a StreamHandle instance for the |
93 // reading the Stream etc. | 94 // Stream. The handle contains the URL for reading the Stream etc. The |
94 // The Stream's origin will be set to |origin|. | 95 // Stream's origin will be set to |origin|. |
95 // | 96 // |
96 // If the stream will be rendered in a BrowserPlugin, |payload| will contain | 97 // If the stream will be rendered in a BrowserPlugin, |payload| will contain |
97 // the data that should be given to the old ResourceHandler to forward to the | 98 // the data that should be given to the old ResourceHandler to forward to the |
98 // renderer process. | 99 // renderer process. |
99 virtual bool ShouldInterceptResourceAsStream(net::URLRequest* request, | 100 virtual bool ShouldInterceptResourceAsStream( |
100 const std::string& mime_type, | 101 net::URLRequest* request, |
101 GURL* origin, | 102 const base::FilePath& plugin_path, |
102 std::string* payload); | 103 const std::string& mime_type, |
| 104 GURL* origin, |
| 105 std::string* payload); |
103 | 106 |
104 // Informs the delegate that a Stream was created. The Stream can be read from | 107 // Informs the delegate that a Stream was created. The Stream can be read from |
105 // the blob URL of the Stream, but can only be read once. | 108 // the blob URL of the Stream, but can only be read once. |
106 virtual void OnStreamCreated(net::URLRequest* request, | 109 virtual void OnStreamCreated(net::URLRequest* request, |
107 scoped_ptr<content::StreamInfo> stream); | 110 scoped_ptr<content::StreamInfo> stream); |
108 | 111 |
109 // Informs the delegate that a response has started. | 112 // Informs the delegate that a response has started. |
110 virtual void OnResponseStarted(net::URLRequest* request, | 113 virtual void OnResponseStarted(net::URLRequest* request, |
111 ResourceContext* resource_context, | 114 ResourceContext* resource_context, |
112 ResourceResponse* response, | 115 ResourceResponse* response, |
113 IPC::Sender* sender); | 116 IPC::Sender* sender); |
114 | 117 |
115 // Informs the delegate that a request has been redirected. | 118 // Informs the delegate that a request has been redirected. |
116 virtual void OnRequestRedirected(const GURL& redirect_url, | 119 virtual void OnRequestRedirected(const GURL& redirect_url, |
117 net::URLRequest* request, | 120 net::URLRequest* request, |
118 ResourceContext* resource_context, | 121 ResourceContext* resource_context, |
119 ResourceResponse* response); | 122 ResourceResponse* response); |
120 | 123 |
121 // Notification that a request has completed. | 124 // Notification that a request has completed. |
122 virtual void RequestComplete(net::URLRequest* url_request); | 125 virtual void RequestComplete(net::URLRequest* url_request); |
123 | 126 |
124 protected: | 127 protected: |
125 ResourceDispatcherHostDelegate(); | 128 ResourceDispatcherHostDelegate(); |
126 virtual ~ResourceDispatcherHostDelegate(); | 129 virtual ~ResourceDispatcherHostDelegate(); |
127 }; | 130 }; |
128 | 131 |
129 } // namespace content | 132 } // namespace content |
130 | 133 |
131 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ | 134 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ |
OLD | NEW |