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 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
30 #include "net/base/escape.h" | 30 #include "net/base/escape.h" |
31 #include "net/base/file_stream.h" | 31 #include "net/base/file_stream.h" |
32 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
33 #include "net/http/http_request_headers.h" | 33 #include "net/http/http_request_headers.h" |
34 #include "net/http/http_response_headers.h" | 34 #include "net/http/http_response_headers.h" |
35 #include "net/http/http_response_info.h" | 35 #include "net/http/http_response_info.h" |
36 #include "net/url_request/url_request.h" | 36 #include "net/url_request/url_request.h" |
| 37 #include "net/url_request/url_request_context.h" |
37 #include "net/url_request/url_request_job.h" | 38 #include "net/url_request/url_request_job.h" |
38 | 39 |
39 using content::BrowserThread; | 40 using content::BrowserThread; |
40 | 41 |
41 namespace gdata { | 42 namespace gdata { |
42 | 43 |
43 namespace { | 44 namespace { |
44 | 45 |
45 const net::UnescapeRule::Type kUrlPathUnescapeMask = | 46 const net::UnescapeRule::Type kUrlPathUnescapeMask = |
46 net::UnescapeRule::SPACES | | 47 net::UnescapeRule::SPACES | |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 216 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
216 scoped_ptr<net::HttpResponseInfo> response_info_; | 217 scoped_ptr<net::HttpResponseInfo> response_info_; |
217 bool streaming_download_; | 218 bool streaming_download_; |
218 scoped_refptr<net::GrowableIOBuffer> download_growable_buf_; | 219 scoped_refptr<net::GrowableIOBuffer> download_growable_buf_; |
219 scoped_refptr<net::DrainableIOBuffer> download_drainable_buf_; | 220 scoped_refptr<net::DrainableIOBuffer> download_drainable_buf_; |
220 | 221 |
221 DISALLOW_COPY_AND_ASSIGN(GDataURLRequestJob); | 222 DISALLOW_COPY_AND_ASSIGN(GDataURLRequestJob); |
222 }; | 223 }; |
223 | 224 |
224 GDataURLRequestJob::GDataURLRequestJob(net::URLRequest* request) | 225 GDataURLRequestJob::GDataURLRequestJob(net::URLRequest* request) |
225 : net::URLRequestJob(request), | 226 : net::URLRequestJob(request, request->context()->network_delegate()), |
226 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( | 227 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( |
227 new base::WeakPtrFactory<GDataURLRequestJob>(this))), | 228 new base::WeakPtrFactory<GDataURLRequestJob>(this))), |
228 file_system_(NULL), | 229 file_system_(NULL), |
229 error_(false), | 230 error_(false), |
230 headers_set_(false), | 231 headers_set_(false), |
231 initial_file_size_(0), | 232 initial_file_size_(0), |
232 remaining_bytes_(0), | 233 remaining_bytes_(0), |
233 streaming_download_(false), | 234 streaming_download_(false), |
234 download_growable_buf_(new net::GrowableIOBuffer) { | 235 download_growable_buf_(new net::GrowableIOBuffer) { |
235 download_growable_buf_->SetCapacity(kInitialDownloadBufferSizeInBytes); | 236 download_growable_buf_->SetCapacity(kInitialDownloadBufferSizeInBytes); |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 GDataProtocolHandler::~GDataProtocolHandler() { | 929 GDataProtocolHandler::~GDataProtocolHandler() { |
929 } | 930 } |
930 | 931 |
931 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( | 932 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( |
932 net::URLRequest* request) const { | 933 net::URLRequest* request) const { |
933 DVLOG(1) << "Handling url: " << request->url().spec(); | 934 DVLOG(1) << "Handling url: " << request->url().spec(); |
934 return new GDataURLRequestJob(request); | 935 return new GDataURLRequestJob(request); |
935 } | 936 } |
936 | 937 |
937 } // namespace gdata | 938 } // namespace gdata |
OLD | NEW |