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

Side by Side Diff: webkit/glue/media/buffered_data_source.cc

Issue 5515008: Using WebFrame::createAssociatedURLLoader() instead of WebFrame::dispatchWillSendRequest(...) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added a setTargetType for the requests 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/media/simple_data_source.cc » ('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 "base/callback.h" 5 #include "base/callback.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // equal to |first_byte_position_|. 137 // equal to |first_byte_position_|.
138 offset_ = first_byte_position_; 138 offset_ = first_byte_position_;
139 } 139 }
140 140
141 // Increment the reference count right before we start the request. This 141 // Increment the reference count right before we start the request. This
142 // reference will be release when this request has ended. 142 // reference will be release when this request has ended.
143 AddRef(); 143 AddRef();
144 144
145 // Prepare the request. 145 // Prepare the request.
146 WebURLRequest request(url_); 146 WebURLRequest request(url_);
147 request.setTargetType(WebURLRequest::TargetIsMedia);
147 request.setHTTPHeaderField(WebString::fromUTF8("Range"), 148 request.setHTTPHeaderField(WebString::fromUTF8("Range"),
148 WebString::fromUTF8(GenerateHeaders( 149 WebString::fromUTF8(GenerateHeaders(
149 first_byte_position_, 150 first_byte_position_,
150 last_byte_position_))); 151 last_byte_position_)));
151 frame->setReferrerForRequest(request, WebKit::WebURL()); 152 frame->setReferrerForRequest(request, WebKit::WebURL());
152 // TODO(annacc): we should be using createAssociatedURLLoader() instead?
153 frame->dispatchWillSendRequest(request);
154 153
155 // This flag is for unittests as we don't want to reset |url_loader| 154 // This flag is for unittests as we don't want to reset |url_loader|
156 if (!keep_test_loader_) 155 if (!keep_test_loader_)
157 url_loader_.reset(WebKit::webKitClient()->createURLLoader()); 156 url_loader_.reset(frame->createAssociatedURLLoader());
158 157
159 // Start the resource loading. 158 // Start the resource loading.
160 url_loader_->loadAsynchronously(request, this); 159 url_loader_->loadAsynchronously(request, this);
161 } 160 }
162 161
163 void BufferedResourceLoader::Stop() { 162 void BufferedResourceLoader::Stop() {
164 // Reset callbacks. 163 // Reset callbacks.
165 start_callback_.reset(); 164 start_callback_.reset();
166 event_callback_.reset(); 165 event_callback_.reset();
167 read_callback_.reset(); 166 read_callback_.reset();
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return; 1149 return;
1151 1150
1152 if (network_activity != network_activity_) { 1151 if (network_activity != network_activity_) {
1153 network_activity_ = network_activity; 1152 network_activity_ = network_activity;
1154 host()->SetNetworkActivity(network_activity); 1153 host()->SetNetworkActivity(network_activity);
1155 } 1154 }
1156 host()->SetBufferedBytes(buffered_last_byte_position + 1); 1155 host()->SetBufferedBytes(buffered_last_byte_position + 1);
1157 } 1156 }
1158 1157
1159 } // namespace webkit_glue 1158 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/media/simple_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698