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

Unified Diff: content/child/npapi/plugin_stream_url.cc

Issue 23503043: Load NPAPI plugin resources through the browser process directly instead of going through the render (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 3 months 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
Index: content/child/npapi/plugin_stream_url.cc
===================================================================
--- content/child/npapi/plugin_stream_url.cc (revision 222566)
+++ content/child/npapi/plugin_stream_url.cc (working copy)
@@ -6,9 +6,11 @@
#include <algorithm>
+#include "base/strings/string_util.h"
#include "content/child/npapi/plugin_host.h"
#include "content/child/npapi/plugin_instance.h"
#include "content/child/npapi/plugin_lib.h"
+#include "content/child/npapi/plugin_url_fetcher.h"
#include "content/child/npapi/webplugin.h"
#include "net/http/http_response_headers.h"
@@ -25,6 +27,21 @@
id_(resource_id) {
}
+void PluginStreamUrl::SetPluginURLFetcher(PluginURLFetcher* fetcher) {
+ plugin_url_fetcher_.reset(fetcher);
+}
+
+void PluginStreamUrl::URLRedirectResponse(bool allow) {
+ if (plugin_url_fetcher_.get()) {
+ plugin_url_fetcher_->URLRedirectResponse(allow);
+ } else {
+ instance()->webplugin()->URLRedirectResponse(allow, id_);
+ }
+
+ if (allow)
+ UpdateUrl(pending_redirect_url_.c_str());
+}
+
bool PluginStreamUrl::Close(NPReason reason) {
// Protect the stream against it being destroyed or the whole plugin instance
// being destroyed within the destroy stream handler.
@@ -41,8 +58,12 @@
void PluginStreamUrl::CancelRequest() {
if (id_ > 0) {
- if (instance()->webplugin()) {
- instance()->webplugin()->CancelResource(id_);
+ if (plugin_url_fetcher_.get()) {
+ plugin_url_fetcher_->Cancel();
+ } else {
+ if (instance()->webplugin()) {
+ instance()->webplugin()->CancelResource(id_);
+ }
}
id_ = 0;
}
@@ -141,7 +162,7 @@
}
PluginStreamUrl::~PluginStreamUrl() {
- if (instance() && instance()->webplugin()) {
+ if (!plugin_url_fetcher_.get() && instance() && instance()->webplugin()) {
instance()->webplugin()->ResourceClientDeleted(AsResourceClient());
}
}
@@ -159,4 +180,11 @@
value);
}
+void PluginStreamUrl::UpdateUrl(const char* url) {
+ DCHECK(!open());
+ free(const_cast<char*>(stream()->url));
+ stream()->url = base::strdup(url);
+ pending_redirect_url_.clear();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698