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

Side by Side Diff: content/child/npapi/plugin_stream_url.cc

Issue 1426923007: Remove PluginLoadObserver and related logic, it was only used for NPAPI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/npapi/plugin_stream_url.h" 5 #include "content/child/npapi/plugin_stream_url.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "content/child/npapi/plugin_host.h" 11 #include "content/child/npapi/plugin_host.h"
12 #include "content/child/npapi/plugin_instance.h" 12 #include "content/child/npapi/plugin_instance.h"
13 #include "content/child/npapi/plugin_lib.h" 13 #include "content/child/npapi/plugin_lib.h"
14 #include "content/child/npapi/plugin_url_fetcher.h" 14 #include "content/child/npapi/plugin_url_fetcher.h"
15 #include "content/child/npapi/webplugin.h" 15 #include "content/child/npapi/webplugin.h"
16 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 PluginStreamUrl::PluginStreamUrl( 20 PluginStreamUrl::PluginStreamUrl(
21 unsigned long resource_id, 21 unsigned long resource_id,
22 const GURL &url, 22 const GURL &url,
23 PluginInstance *instance, 23 PluginInstance *instance)
24 bool notify_needed, 24 : PluginStream(instance, url.spec().c_str()),
25 void *notify_data)
26 : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data),
27 url_(url), 25 url_(url),
28 id_(resource_id) { 26 id_(resource_id) {
29 } 27 }
30 28
31 void PluginStreamUrl::SetPluginURLFetcher(PluginURLFetcher* fetcher) { 29 void PluginStreamUrl::SetPluginURLFetcher(PluginURLFetcher* fetcher) {
32 plugin_url_fetcher_.reset(fetcher); 30 plugin_url_fetcher_.reset(fetcher);
33 } 31 }
34 32
35 void PluginStreamUrl::URLRedirectResponse(bool allow) { 33 void PluginStreamUrl::URLRedirectResponse(bool allow) {
36 if (plugin_url_fetcher_.get()) { 34 if (plugin_url_fetcher_.get()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 for (size_t i = 0; i < range_requests_.size(); ++i) 81 for (size_t i = 0; i < range_requests_.size(); ++i)
84 instance()->webplugin()->CancelResource(range_requests_[i]); 82 instance()->webplugin()->CancelResource(range_requests_[i]);
85 } 83 }
86 84
87 range_requests_.clear(); 85 range_requests_.clear();
88 86
89 STLDeleteElements(&range_request_fetchers_); 87 STLDeleteElements(&range_request_fetchers_);
90 } 88 }
91 89
92 void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) { 90 void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) {
93 if (notify_needed()) {
94 // If the plugin participates in HTTP url redirect handling then notify it.
95 if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) &&
96 instance()->handles_url_redirects()) {
97 pending_redirect_url_ = url.spec();
98 instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code,
99 notify_data());
100 return;
101 }
102 }
103 url_ = url; 91 url_ = url;
104 UpdateUrl(url.spec().c_str()); 92 UpdateUrl(url.spec().c_str());
105 } 93 }
106 94
107 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, 95 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type,
108 const std::string& headers, 96 const std::string& headers,
109 uint32 expected_length, 97 uint32 expected_length,
110 uint32 last_modified, 98 uint32 last_modified,
111 bool request_is_seekable) { 99 bool request_is_seekable) {
112 // Protect the stream against it being destroyed or the whole plugin instance 100 // Protect the stream against it being destroyed or the whole plugin instance
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 196 }
209 197
210 void PluginStreamUrl::UpdateUrl(const char* url) { 198 void PluginStreamUrl::UpdateUrl(const char* url) {
211 DCHECK(!open()); 199 DCHECK(!open());
212 free(const_cast<char*>(stream()->url)); 200 free(const_cast<char*>(stream()->url));
213 stream()->url = base::strdup(url); 201 stream()->url = base::strdup(url);
214 pending_redirect_url_.clear(); 202 pending_redirect_url_.clear();
215 } 203 }
216 204
217 } // namespace content 205 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698