Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: webkit/glue/plugins/plugin_stream_url.cc

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/plugins/plugin_stream_url.h ('k') | webkit/glue/plugins/plugin_stream_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/plugin_stream_url.cc
===================================================================
--- webkit/glue/plugins/plugin_stream_url.cc (revision 69426)
+++ webkit/glue/plugins/plugin_stream_url.cc (working copy)
@@ -1,130 +0,0 @@
-// Copyright (c) 2010 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 "webkit/glue/plugins/plugin_stream_url.h"
-
-#include "net/http/http_response_headers.h"
-#include "webkit/glue/plugins/plugin_host.h"
-#include "webkit/glue/plugins/plugin_instance.h"
-#include "webkit/glue/plugins/plugin_lib.h"
-#include "webkit/glue/plugins/webplugin.h"
-
-namespace NPAPI {
-
-PluginStreamUrl::PluginStreamUrl(
- unsigned long resource_id,
- const GURL &url,
- PluginInstance *instance,
- bool notify_needed,
- void *notify_data)
- : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data),
- url_(url),
- id_(resource_id) {
-}
-
-PluginStreamUrl::~PluginStreamUrl() {
- if (instance() && instance()->webplugin()) {
- instance()->webplugin()->ResourceClientDeleted(AsResourceClient());
- }
-}
-
-bool PluginStreamUrl::Close(NPReason reason) {
- // Protect the stream against it being destroyed or the whole plugin instance
- // being destroyed within the destroy stream handler.
- scoped_refptr<PluginStream> protect(this);
- CancelRequest();
- bool result = PluginStream::Close(reason);
- instance()->RemoveStream(this);
- return result;
-}
-
-webkit_glue::WebPluginResourceClient* PluginStreamUrl::AsResourceClient() {
- return static_cast<webkit_glue::WebPluginResourceClient*>(this);
-}
-
-void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) {
- if (notify_needed()) {
- // If the plugin participates in HTTP url redirect handling then notify it.
- if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) &&
- instance()->handles_url_redirects()) {
- pending_redirect_url_ = url.spec();
- instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code,
- notify_data());
- return;
- }
- }
- url_ = url;
- UpdateUrl(url.spec().c_str());
-}
-
-void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type,
- const std::string& headers,
- uint32 expected_length,
- uint32 last_modified,
- bool request_is_seekable) {
- // Protect the stream against it being destroyed or the whole plugin instance
- // being destroyed within the new stream handler.
- scoped_refptr<PluginStream> protect(this);
-
- bool opened = Open(mime_type,
- headers,
- expected_length,
- last_modified,
- request_is_seekable);
- if (!opened) {
- CancelRequest();
- instance()->RemoveStream(this);
- } else {
- if (id_ > 0)
- instance()->webplugin()->SetDeferResourceLoading(id_, false);
- }
-}
-
-void PluginStreamUrl::DidReceiveData(const char* buffer, int length,
- int data_offset) {
- if (!open())
- return;
-
- // Protect the stream against it being destroyed or the whole plugin instance
- // being destroyed within the write handlers
- scoped_refptr<PluginStream> protect(this);
-
- if (length > 0) {
- // The PluginStreamUrl instance could get deleted if the plugin fails to
- // accept data in NPP_Write.
- if (Write(const_cast<char*>(buffer), length, data_offset) > 0) {
- if (id_ > 0)
- instance()->webplugin()->SetDeferResourceLoading(id_, false);
- }
- }
-}
-
-void PluginStreamUrl::DidFinishLoading() {
- if (!seekable()) {
- Close(NPRES_DONE);
- }
-}
-
-void PluginStreamUrl::DidFail() {
- Close(NPRES_NETWORK_ERR);
-}
-
-bool PluginStreamUrl::IsMultiByteResponseExpected() {
- return seekable();
-}
-
-int PluginStreamUrl::ResourceId() {
- return id_;
-}
-
-void PluginStreamUrl::CancelRequest() {
- if (id_ > 0) {
- if (instance()->webplugin()) {
- instance()->webplugin()->CancelResource(id_);
- }
- id_ = 0;
- }
-}
-
-} // namespace NPAPI
« no previous file with comments | « webkit/glue/plugins/plugin_stream_url.h ('k') | webkit/glue/plugins/plugin_stream_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698