This source file includes following definitions.
- SendToPlugin
#include "content/child/npapi/plugin_string_stream.h"
#include "url/gurl.h"
namespace content {
PluginStringStream::PluginStringStream(
PluginInstance* instance,
const GURL& url,
bool notify_needed,
void* notify_data)
: PluginStream(instance, url.spec().c_str(), notify_needed, notify_data) {
}
PluginStringStream::~PluginStringStream() {
}
void PluginStringStream::SendToPlugin(const std::string &data,
const std::string &mime_type) {
scoped_refptr<PluginStringStream> protect(this);
int length = static_cast<int>(data.length());
if (Open(mime_type, std::string(), length, 0, false)) {
int written = Write(data.c_str(), length, 0);
NPReason reason = written == length ? NPRES_DONE : NPRES_NETWORK_ERR;
Close(reason);
}
}
}