cef/libcef/plugins/browser_plugin_string_stream.cc
Marshall Greenblatt a08ad505ad libcef:
- Add support for embedded netscape-style plugins.
- Add new webkit_glue VisitedLinkHash() and IsLinkVisited() functions required by underlying chromium changes.
cefclient:
- Add sample netscape-style plugin implementation and related Plugin item on the Tests menu.
- Increase the speed of the update timer so that buttons refresh closer to real-time.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@5 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2008-12-14 04:49:18 +00:00

35 lines
1.1 KiB
C++

// Copyright (c) 2008 The Chromium Embedded Framework Authors.
// Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "precompiled_libcef.h"
#include "browser_plugin_string_stream.h"
namespace NPAPI {
BrowserPluginStringStream::BrowserPluginStringStream(
BrowserPluginInstance *instance,
const std::string &url,
bool notify_needed,
void *notify_data)
: BrowserPluginStream(instance, url.c_str(), notify_needed, notify_data) {
}
BrowserPluginStringStream::~BrowserPluginStringStream() {
}
void BrowserPluginStringStream::SendToPlugin(const std::string &data,
const std::string &mime_type) {
int length = static_cast<int>(data.length());
if (Open(mime_type, std::string(), length, 0)) {
// TODO - check if it was not fully sent, and figure out a backup plan.
int written = Write(data.c_str(), length, 0);
NPReason reason = written == length ? NPRES_DONE : NPRES_NETWORK_ERR;
Close(reason);
}
}
}