| 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_string_stream.h" | 5 #include "webkit/glue/plugins/plugin_string_stream.h" |
| 6 | 6 |
| 7 namespace NPAPI { | 7 namespace NPAPI { |
| 8 | 8 |
| 9 PluginStringStream::PluginStringStream( | 9 PluginStringStream::PluginStringStream( |
| 10 PluginInstance *instance, | 10 PluginInstance *instance, |
| 11 const std::string &url, | 11 const std::string &url, |
| 12 bool notify_needed, | 12 bool notify_needed, |
| 13 void *notify_data) | 13 void *notify_data) |
| 14 : PluginStream(instance, url.c_str(), notify_needed, notify_data) { | 14 : PluginStream(instance, url.c_str(), notify_needed, notify_data) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 PluginStringStream::~PluginStringStream() { | 17 PluginStringStream::~PluginStringStream() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 void PluginStringStream::SendToPlugin(const std::string &data, | 20 void PluginStringStream::SendToPlugin(const std::string &data, |
| 21 const std::string &mime_type) { | 21 const std::string &mime_type) { |
| 22 int length = static_cast<int>(data.length()); | 22 int length = static_cast<int>(data.length()); |
| 23 if (Open(mime_type, std::string(), length, 0)) { | 23 if (Open(mime_type, std::string(), length, 0, false)) { |
| 24 // TODO - check if it was not fully sent, and figure out a backup plan. | 24 // TODO - check if it was not fully sent, and figure out a backup plan. |
| 25 int written = Write(data.c_str(), length, 0); | 25 int written = Write(data.c_str(), length, 0); |
| 26 NPReason reason = written == length ? NPRES_DONE : NPRES_NETWORK_ERR; | 26 NPReason reason = written == length ? NPRES_DONE : NPRES_NETWORK_ERR; |
| 27 Close(reason); | 27 Close(reason); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 } | 31 } |
| 32 | 32 |
| OLD | NEW |