| 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 #include "webkit/glue/plugins/plugin_stream_url.h" | 5 #include "webkit/glue/plugins/plugin_stream_url.h" |
| 6 | 6 |
| 7 #include "webkit/glue/glue_util.h" | 7 #include "webkit/glue/glue_util.h" |
| 8 #include "webkit/glue/webplugin.h" | 8 #include "webkit/glue/webplugin.h" |
| 9 #include "webkit/glue/plugins/plugin_host.h" | 9 #include "webkit/glue/plugins/plugin_host.h" |
| 10 #include "webkit/glue/plugins/plugin_instance.h" | 10 #include "webkit/glue/plugins/plugin_instance.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 void PluginStreamUrl::WillSendRequest(const GURL& url) { | 38 void PluginStreamUrl::WillSendRequest(const GURL& url) { |
| 39 url_ = url; | 39 url_ = url; |
| 40 UpdateUrl(url.spec().c_str()); | 40 UpdateUrl(url.spec().c_str()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, | 43 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, |
| 44 const std::string& headers, | 44 const std::string& headers, |
| 45 uint32 expected_length, | 45 uint32 expected_length, |
| 46 uint32 last_modified, | 46 uint32 last_modified, |
| 47 bool request_is_seekable, | 47 bool request_is_seekable) { |
| 48 bool* cancel) { | |
| 49 bool opened = Open(mime_type, | 48 bool opened = Open(mime_type, |
| 50 headers, | 49 headers, |
| 51 expected_length, | 50 expected_length, |
| 52 last_modified, | 51 last_modified, |
| 53 request_is_seekable); | 52 request_is_seekable); |
| 54 if (!opened) { | 53 if (!opened) { |
| 55 instance()->RemoveStream(this); | 54 instance()->RemoveStream(this); |
| 56 *cancel = true; | 55 CancelRequest(); |
| 57 } | 56 } |
| 58 } | 57 } |
| 59 | 58 |
| 60 void PluginStreamUrl::DidReceiveData(const char* buffer, int length, | 59 void PluginStreamUrl::DidReceiveData(const char* buffer, int length, |
| 61 int data_offset) { | 60 int data_offset) { |
| 62 if (!open()) | 61 if (!open()) |
| 63 return; | 62 return; |
| 64 | 63 |
| 65 if (length > 0) | 64 if (length > 0) |
| 66 Write(const_cast<char*>(buffer), length, data_offset); | 65 Write(const_cast<char*>(buffer), length, data_offset); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 void PluginStreamUrl::CancelRequest() { | 78 void PluginStreamUrl::CancelRequest() { |
| 80 if (id_ > 0) { | 79 if (id_ > 0) { |
| 81 if (instance()->webplugin()) { | 80 if (instance()->webplugin()) { |
| 82 instance()->webplugin()->CancelResource(id_); | 81 instance()->webplugin()->CancelResource(id_); |
| 83 } | 82 } |
| 84 id_ = 0; | 83 id_ = 0; |
| 85 } | 84 } |
| 86 } | 85 } |
| 87 | 86 |
| 88 } // namespace NPAPI | 87 } // namespace NPAPI |
| OLD | NEW |