OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "webkit/glue/plugins/plugin_stream_url.h" | 5 #include "webkit/glue/plugins/plugin_stream_url.h" |
6 | 6 |
7 #include "net/http/http_response_headers.h" | 7 #include "net/http/http_response_headers.h" |
8 #include "webkit/glue/plugins/plugin_host.h" | 8 #include "webkit/glue/plugins/plugin_host.h" |
9 #include "webkit/glue/plugins/plugin_instance.h" | 9 #include "webkit/glue/plugins/plugin_instance.h" |
10 #include "webkit/glue/plugins/plugin_lib.h" | 10 #include "webkit/glue/plugins/plugin_lib.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 bool PluginStreamUrl::Close(NPReason reason) { | 32 bool PluginStreamUrl::Close(NPReason reason) { |
33 // Protect the stream against it being destroyed or the whole plugin instance | 33 // Protect the stream against it being destroyed or the whole plugin instance |
34 // being destroyed within the destroy stream handler. | 34 // being destroyed within the destroy stream handler. |
35 scoped_refptr<PluginStream> protect(this); | 35 scoped_refptr<PluginStream> protect(this); |
36 CancelRequest(); | 36 CancelRequest(); |
37 bool result = PluginStream::Close(reason); | 37 bool result = PluginStream::Close(reason); |
38 instance()->RemoveStream(this); | 38 instance()->RemoveStream(this); |
39 return result; | 39 return result; |
40 } | 40 } |
41 | 41 |
| 42 webkit_glue::WebPluginResourceClient* PluginStreamUrl::AsResourceClient() { |
| 43 return static_cast<webkit_glue::WebPluginResourceClient*>(this); |
| 44 } |
| 45 |
42 void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) { | 46 void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) { |
43 if (notify_needed()) { | 47 if (notify_needed()) { |
44 // If the plugin participates in HTTP url redirect handling then notify it. | 48 // If the plugin participates in HTTP url redirect handling then notify it. |
45 if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) && | 49 if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) && |
46 instance()->handles_url_redirects()) { | 50 instance()->handles_url_redirects()) { |
47 pending_redirect_url_ = url.spec(); | 51 pending_redirect_url_ = url.spec(); |
48 instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code, | 52 instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code, |
49 notify_data()); | 53 notify_data()); |
50 return; | 54 return; |
51 } | 55 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void PluginStreamUrl::CancelRequest() { | 121 void PluginStreamUrl::CancelRequest() { |
118 if (id_ > 0) { | 122 if (id_ > 0) { |
119 if (instance()->webplugin()) { | 123 if (instance()->webplugin()) { |
120 instance()->webplugin()->CancelResource(id_); | 124 instance()->webplugin()->CancelResource(id_); |
121 } | 125 } |
122 id_ = 0; | 126 id_ = 0; |
123 } | 127 } |
124 } | 128 } |
125 | 129 |
126 } // namespace NPAPI | 130 } // namespace NPAPI |
OLD | NEW |