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

Side by Side Diff: webkit/plugins/npapi/plugin_stream_url.cc

Issue 10066044: RefCounted types should not have public destructors, webkit/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation ordering Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/npapi/plugin_stream_url.h ('k') | webkit/quota/mock_quota_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/plugins/npapi/plugin_stream_url.h" 5 #include "webkit/plugins/npapi/plugin_stream_url.h"
6 6
7 #include "net/http/http_response_headers.h" 7 #include "net/http/http_response_headers.h"
8 #include "webkit/plugins/npapi/plugin_host.h" 8 #include "webkit/plugins/npapi/plugin_host.h"
9 #include "webkit/plugins/npapi/plugin_instance.h" 9 #include "webkit/plugins/npapi/plugin_instance.h"
10 #include "webkit/plugins/npapi/plugin_lib.h" 10 #include "webkit/plugins/npapi/plugin_lib.h"
11 #include "webkit/plugins/npapi/webplugin.h" 11 #include "webkit/plugins/npapi/webplugin.h"
12 12
13 namespace webkit { 13 namespace webkit {
14 namespace npapi { 14 namespace npapi {
15 15
16 PluginStreamUrl::PluginStreamUrl( 16 PluginStreamUrl::PluginStreamUrl(
17 unsigned long resource_id, 17 unsigned long resource_id,
18 const GURL &url, 18 const GURL &url,
19 PluginInstance *instance, 19 PluginInstance *instance,
20 bool notify_needed, 20 bool notify_needed,
21 void *notify_data) 21 void *notify_data)
22 : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data), 22 : PluginStream(instance, url.spec().c_str(), notify_needed, notify_data),
23 url_(url), 23 url_(url),
24 id_(resource_id) { 24 id_(resource_id) {
25 } 25 }
26 26
27 PluginStreamUrl::~PluginStreamUrl() {
28 if (instance() && instance()->webplugin()) {
29 instance()->webplugin()->ResourceClientDeleted(AsResourceClient());
30 }
31 }
32
33 bool PluginStreamUrl::Close(NPReason reason) { 27 bool PluginStreamUrl::Close(NPReason reason) {
34 // Protect the stream against it being destroyed or the whole plugin instance 28 // Protect the stream against it being destroyed or the whole plugin instance
35 // being destroyed within the destroy stream handler. 29 // being destroyed within the destroy stream handler.
36 scoped_refptr<PluginStream> protect(this); 30 scoped_refptr<PluginStream> protect(this);
37 CancelRequest(); 31 CancelRequest();
38 bool result = PluginStream::Close(reason); 32 bool result = PluginStream::Close(reason);
39 instance()->RemoveStream(this); 33 instance()->RemoveStream(this);
40 return result; 34 return result;
41 } 35 }
42 36
43 WebPluginResourceClient* PluginStreamUrl::AsResourceClient() { 37 WebPluginResourceClient* PluginStreamUrl::AsResourceClient() {
44 return static_cast<WebPluginResourceClient*>(this); 38 return static_cast<WebPluginResourceClient*>(this);
45 } 39 }
46 40
41 void PluginStreamUrl::CancelRequest() {
42 if (id_ > 0) {
43 if (instance()->webplugin()) {
44 instance()->webplugin()->CancelResource(id_);
45 }
46 id_ = 0;
47 }
48 }
49
47 void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) { 50 void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) {
48 if (notify_needed()) { 51 if (notify_needed()) {
49 // If the plugin participates in HTTP url redirect handling then notify it. 52 // If the plugin participates in HTTP url redirect handling then notify it.
50 if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) && 53 if (net::HttpResponseHeaders::IsRedirectResponseCode(http_status_code) &&
51 instance()->handles_url_redirects()) { 54 instance()->handles_url_redirects()) {
52 pending_redirect_url_ = url.spec(); 55 pending_redirect_url_ = url.spec();
53 instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code, 56 instance()->NPP_URLRedirectNotify(url.spec().c_str(), http_status_code,
54 notify_data()); 57 notify_data());
55 return; 58 return;
56 } 59 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 115 }
113 116
114 bool PluginStreamUrl::IsMultiByteResponseExpected() { 117 bool PluginStreamUrl::IsMultiByteResponseExpected() {
115 return seekable(); 118 return seekable();
116 } 119 }
117 120
118 int PluginStreamUrl::ResourceId() { 121 int PluginStreamUrl::ResourceId() {
119 return id_; 122 return id_;
120 } 123 }
121 124
122 void PluginStreamUrl::CancelRequest() { 125 PluginStreamUrl::~PluginStreamUrl() {
123 if (id_ > 0) { 126 if (instance() && instance()->webplugin()) {
124 if (instance()->webplugin()) { 127 instance()->webplugin()->ResourceClientDeleted(AsResourceClient());
125 instance()->webplugin()->CancelResource(id_);
126 }
127 id_ = 0;
128 } 128 }
129 } 129 }
130 130
131 } // namespace npapi 131 } // namespace npapi
132 } // namespace webkit 132 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_stream_url.h ('k') | webkit/quota/mock_quota_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698