Files
cef/libcef/plugins/browser_plugin_stream_url.cc
Marshall Greenblatt 8dab71f659 libcef: Update due to underlying chromium changes.
- Canvas classes moved from gfx namespace to skia namespace.
- Include files moved from WebKit/port to third_party/WebKit.
- Add IsMediaPlayerAvailable() webkit_glue function.
- WebWidgetDelegate::GetContainingWindow() changed to WebWidgetDelegate::GetContainingView().
- Changed HCURSOR to WebCursor and HWND to gfx::NativeWindow.
- WebPluginInfo 'file' member changed to 'path'.
- Use base::LazyInstance for static object in BrowserPluginInstance (should be done at some point for BrowserPluginLib and BrowserPluginList as well).
- BrowserPluginStream::Open() adds additional 'request_is_seekable' parameter.
- Add PLUGIN_QUIRK_PATCH_SETCURSOR support to BrowserWebPluginDelegateImpl.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@6 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2009-01-14 19:54:37 +00:00

89 lines
2.4 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_stream_url.h"
#include "browser_plugin_instance.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webplugin.h"
#include "webkit/glue/plugins/plugin_host.h"
namespace NPAPI {
BrowserPluginStreamUrl::BrowserPluginStreamUrl(
int resource_id,
const GURL &url,
BrowserPluginInstance *instance,
bool notify_needed,
void *notify_data)
: BrowserPluginStream(instance, url.spec().c_str(), notify_needed, notify_data),
url_(url),
id_(resource_id) {
}
BrowserPluginStreamUrl::~BrowserPluginStreamUrl() {
}
bool BrowserPluginStreamUrl::Close(NPReason reason) {
CancelRequest();
bool result = BrowserPluginStream::Close(reason);
instance()->RemoveStream(this);
return result;
}
void BrowserPluginStreamUrl::WillSendRequest(const GURL& url) {
url_ = url;
UpdateUrl(url.spec().c_str());
}
void BrowserPluginStreamUrl::DidReceiveResponse(const std::string& mime_type,
const std::string& headers,
uint32 expected_length,
uint32 last_modified,
bool request_is_seekable,
bool* cancel) {
bool opened = Open(mime_type,
headers,
expected_length,
last_modified,
request_is_seekable);
if (!opened) {
instance()->RemoveStream(this);
*cancel = true;
}
}
void BrowserPluginStreamUrl::DidReceiveData(const char* buffer, int length,
int data_offset) {
if (!open())
return;
if (length > 0)
Write(const_cast<char*>(buffer), length, data_offset);
}
void BrowserPluginStreamUrl::DidFinishLoading() {
if (!seekable()) {
Close(NPRES_DONE);
}
}
void BrowserPluginStreamUrl::DidFail() {
Close(NPRES_NETWORK_ERR);
}
void BrowserPluginStreamUrl::CancelRequest() {
if (id_ > 0) {
if (instance()->webplugin()) {
instance()->webplugin()->CancelResource(id_);
}
id_ = 0;
}
}
} // namespace NPAPI