| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 | 7 |
| 8 #include "webkit/glue/plugins/plugin_stream_url.h" | 8 #include "webkit/glue/plugins/plugin_stream_url.h" |
| 9 | 9 |
| 10 #include "webkit/glue/glue_util.h" | 10 #include "webkit/glue/glue_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 void PluginStreamUrl::WillSendRequest(const GURL& url) { | 41 void PluginStreamUrl::WillSendRequest(const GURL& url) { |
| 42 url_ = url; | 42 url_ = url; |
| 43 UpdateUrl(url.spec().c_str()); | 43 UpdateUrl(url.spec().c_str()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, | 46 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, |
| 47 const std::string& headers, | 47 const std::string& headers, |
| 48 uint32 expected_length, | 48 uint32 expected_length, |
| 49 uint32 last_modified, | 49 uint32 last_modified, |
| 50 bool request_is_seekable, | 50 bool request_is_seekable) { |
| 51 bool* cancel) { | |
| 52 bool opened = Open(mime_type, | 51 bool opened = Open(mime_type, |
| 53 headers, | 52 headers, |
| 54 expected_length, | 53 expected_length, |
| 55 last_modified, | 54 last_modified, |
| 56 request_is_seekable); | 55 request_is_seekable); |
| 57 if (!opened) { | 56 if (!opened) { |
| 57 CancelRequest(); |
| 58 instance()->RemoveStream(this); | 58 instance()->RemoveStream(this); |
| 59 *cancel = true; | 59 } else { |
| 60 if (id_ > 0) |
| 61 instance()->webplugin()->SetDeferResourceLoading(id_, false); |
| 60 } | 62 } |
| 61 } | 63 } |
| 62 | 64 |
| 63 void PluginStreamUrl::DidReceiveData(const char* buffer, int length, | 65 void PluginStreamUrl::DidReceiveData(const char* buffer, int length, |
| 64 int data_offset) { | 66 int data_offset) { |
| 65 if (!open()) | 67 if (!open()) |
| 66 return; | 68 return; |
| 67 | 69 |
| 68 if (length > 0) | 70 if (length > 0) { |
| 69 Write(const_cast<char*>(buffer), length, data_offset); | 71 Write(const_cast<char*>(buffer), length, data_offset); |
| 72 if (id_ > 0) |
| 73 instance()->webplugin()->SetDeferResourceLoading(id_, false); |
| 74 } |
| 70 } | 75 } |
| 71 | 76 |
| 72 void PluginStreamUrl::DidFinishLoading() { | 77 void PluginStreamUrl::DidFinishLoading() { |
| 73 if (!seekable()) { | 78 if (!seekable()) { |
| 74 Close(NPRES_DONE); | 79 Close(NPRES_DONE); |
| 75 } | 80 } |
| 76 } | 81 } |
| 77 | 82 |
| 78 void PluginStreamUrl::DidFail() { | 83 void PluginStreamUrl::DidFail() { |
| 79 Close(NPRES_NETWORK_ERR); | 84 Close(NPRES_NETWORK_ERR); |
| 80 } | 85 } |
| 81 | 86 |
| 82 void PluginStreamUrl::CancelRequest() { | 87 void PluginStreamUrl::CancelRequest() { |
| 83 if (id_ > 0) { | 88 if (id_ > 0) { |
| 84 if (instance()->webplugin()) { | 89 if (instance()->webplugin()) { |
| 85 instance()->webplugin()->CancelResource(id_); | 90 instance()->webplugin()->CancelResource(id_); |
| 86 } | 91 } |
| 87 id_ = 0; | 92 id_ = 0; |
| 88 } | 93 } |
| 89 } | 94 } |
| 90 | 95 |
| 91 } // namespace NPAPI | 96 } // namespace NPAPI |
| OLD | NEW |