OLD | NEW |
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 "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "net/base/escape.h" | 29 #include "net/base/escape.h" |
30 #include "net/base/file_stream.h" | 30 #include "net/base/file_stream.h" |
31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
32 #include "net/http/http_request_headers.h" | 32 #include "net/http/http_request_headers.h" |
33 #include "net/http/http_response_headers.h" | 33 #include "net/http/http_response_headers.h" |
34 #include "net/http/http_response_info.h" | 34 #include "net/http/http_response_info.h" |
35 #include "net/url_request/url_request.h" | 35 #include "net/url_request/url_request.h" |
| 36 #include "net/url_request/url_request_context.h" |
36 #include "net/url_request/url_request_job.h" | 37 #include "net/url_request/url_request_job.h" |
37 | 38 |
38 using content::BrowserThread; | 39 using content::BrowserThread; |
39 | 40 |
40 namespace gdata { | 41 namespace gdata { |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
44 const net::UnescapeRule::Type kUrlPathUnescapeMask = | 45 const net::UnescapeRule::Type kUrlPathUnescapeMask = |
45 net::UnescapeRule::SPACES | | 46 net::UnescapeRule::SPACES | |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 212 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
212 scoped_ptr<net::HttpResponseInfo> response_info_; | 213 scoped_ptr<net::HttpResponseInfo> response_info_; |
213 bool streaming_download_; | 214 bool streaming_download_; |
214 scoped_refptr<net::GrowableIOBuffer> download_growable_buf_; | 215 scoped_refptr<net::GrowableIOBuffer> download_growable_buf_; |
215 scoped_refptr<net::DrainableIOBuffer> download_drainable_buf_; | 216 scoped_refptr<net::DrainableIOBuffer> download_drainable_buf_; |
216 | 217 |
217 DISALLOW_COPY_AND_ASSIGN(GDataURLRequestJob); | 218 DISALLOW_COPY_AND_ASSIGN(GDataURLRequestJob); |
218 }; | 219 }; |
219 | 220 |
220 GDataURLRequestJob::GDataURLRequestJob(net::URLRequest* request) | 221 GDataURLRequestJob::GDataURLRequestJob(net::URLRequest* request) |
221 : net::URLRequestJob(request), | 222 : net::URLRequestJob(request, request->context()->network_delegate()), |
222 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( | 223 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( |
223 new base::WeakPtrFactory<GDataURLRequestJob>(this))), | 224 new base::WeakPtrFactory<GDataURLRequestJob>(this))), |
224 file_system_(NULL), | 225 file_system_(NULL), |
225 error_(false), | 226 error_(false), |
226 headers_set_(false), | 227 headers_set_(false), |
227 initial_file_size_(0), | 228 initial_file_size_(0), |
228 remaining_bytes_(0), | 229 remaining_bytes_(0), |
229 streaming_download_(false), | 230 streaming_download_(false), |
230 download_growable_buf_(new net::GrowableIOBuffer) { | 231 download_growable_buf_(new net::GrowableIOBuffer) { |
231 download_growable_buf_->SetCapacity(kInitialDownloadBufferSizeInBytes); | 232 download_growable_buf_->SetCapacity(kInitialDownloadBufferSizeInBytes); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 GDataProtocolHandler::~GDataProtocolHandler() { | 921 GDataProtocolHandler::~GDataProtocolHandler() { |
921 } | 922 } |
922 | 923 |
923 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( | 924 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( |
924 net::URLRequest* request) const { | 925 net::URLRequest* request) const { |
925 DVLOG(1) << "Handling url: " << request->url().spec(); | 926 DVLOG(1) << "Handling url: " << request->url().spec(); |
926 return new GDataURLRequestJob(request); | 927 return new GDataURLRequestJob(request); |
927 } | 928 } |
928 | 929 |
929 } // namespace gdata | 930 } // namespace gdata |
OLD | NEW |