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

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

Issue 159746: Another attempt at landing this patch.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/glue/plugins/plugin_stream_url.h" 5 #include "webkit/glue/plugins/plugin_stream_url.h"
6 6
7 #include "webkit/glue/glue_util.h" 7 #include "webkit/glue/glue_util.h"
8 #include "webkit/glue/webplugin.h" 8 #include "webkit/glue/webplugin.h"
9 #include "webkit/glue/plugins/plugin_host.h" 9 #include "webkit/glue/plugins/plugin_host.h"
10 #include "webkit/glue/plugins/plugin_instance.h" 10 #include "webkit/glue/plugins/plugin_instance.h"
(...skipping 26 matching lines...) Expand all
37 37
38 void PluginStreamUrl::WillSendRequest(const GURL& url) { 38 void PluginStreamUrl::WillSendRequest(const GURL& url) {
39 url_ = url; 39 url_ = url;
40 UpdateUrl(url.spec().c_str()); 40 UpdateUrl(url.spec().c_str());
41 } 41 }
42 42
43 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type, 43 void PluginStreamUrl::DidReceiveResponse(const std::string& mime_type,
44 const std::string& headers, 44 const std::string& headers,
45 uint32 expected_length, 45 uint32 expected_length,
46 uint32 last_modified, 46 uint32 last_modified,
47 bool request_is_seekable, 47 bool request_is_seekable) {
48 bool* cancel) {
49 bool opened = Open(mime_type, 48 bool opened = Open(mime_type,
50 headers, 49 headers,
51 expected_length, 50 expected_length,
52 last_modified, 51 last_modified,
53 request_is_seekable); 52 request_is_seekable);
54 if (!opened) { 53 if (!opened) {
54 CancelRequest();
55 instance()->RemoveStream(this); 55 instance()->RemoveStream(this);
56 *cancel = true; 56 } else {
57 if (id_ > 0)
58 instance()->webplugin()->SetDeferResourceLoading(id_, false);
57 } 59 }
58 } 60 }
59 61
60 void PluginStreamUrl::DidReceiveData(const char* buffer, int length, 62 void PluginStreamUrl::DidReceiveData(const char* buffer, int length,
61 int data_offset) { 63 int data_offset) {
62 if (!open()) 64 if (!open())
63 return; 65 return;
64 66
65 if (length > 0) 67 if (length > 0) {
66 Write(const_cast<char*>(buffer), length, data_offset); 68 Write(const_cast<char*>(buffer), length, data_offset);
69 if (id_ > 0)
70 instance()->webplugin()->SetDeferResourceLoading(id_, false);
71 }
67 } 72 }
68 73
69 void PluginStreamUrl::DidFinishLoading() { 74 void PluginStreamUrl::DidFinishLoading() {
70 if (!seekable()) { 75 if (!seekable()) {
71 Close(NPRES_DONE); 76 Close(NPRES_DONE);
72 } 77 }
73 } 78 }
74 79
75 void PluginStreamUrl::DidFail() { 80 void PluginStreamUrl::DidFail() {
76 Close(NPRES_NETWORK_ERR); 81 Close(NPRES_NETWORK_ERR);
77 } 82 }
78 83
79 void PluginStreamUrl::CancelRequest() { 84 void PluginStreamUrl::CancelRequest() {
80 if (id_ > 0) { 85 if (id_ > 0) {
81 if (instance()->webplugin()) { 86 if (instance()->webplugin()) {
82 instance()->webplugin()->CancelResource(id_); 87 instance()->webplugin()->CancelResource(id_);
83 } 88 }
84 id_ = 0; 89 id_ = 0;
85 } 90 }
86 } 91 }
87 92
88 } // namespace NPAPI 93 } // namespace NPAPI
OLDNEW
« no previous file with comments | « webkit/glue/plugins/plugin_stream_url.h ('k') | webkit/glue/plugins/test/plugin_get_javascript_url_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698