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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_protocol_handler.cc

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 years, 6 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) 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // 2) Reply task StartAsync is invoked. 236 // 2) Reply task StartAsync is invoked.
237 // 3) If unable to get file system or request method is not GET, report start 237 // 3) If unable to get file system or request method is not GET, report start
238 // error and bail out. 238 // error and bail out.
239 // 4) Otherwise, parse request url to get resource id and file name. 239 // 4) Otherwise, parse request url to get resource id and file name.
240 // 5) Find file from file system to get its mime type, gdata file path and 240 // 5) Find file from file system to get its mime type, gdata file path and
241 // size of physical file. 241 // size of physical file.
242 // 6) Get file from file system asynchronously with both GetFileCallback and 242 // 6) Get file from file system asynchronously with both GetFileCallback and
243 // GetDownloadDataCallback - this would either get it from cache or 243 // GetDownloadDataCallback - this would either get it from cache or
244 // download it from gdata. 244 // download it from gdata.
245 // 7) If file is downloaded from gdata: 245 // 7) If file is downloaded from gdata:
246 // 7.1) Whenever content::URLFetcherCore::OnReadCompleted() receives a part 246 // 7.1) Whenever net::URLFetcherCore::OnReadCompleted() receives a part
247 // of the response, it invokes 247 // of the response, it invokes
248 // constent::URLFetcherDelegate::OnURLFetchDownloadData() if 248 // constent::URLFetcherDelegate::OnURLFetchDownloadData() if
249 // net::URLFetcherDelegate::ShouldSendDownloadData() is true. 249 // net::URLFetcherDelegate::ShouldSendDownloadData() is true.
250 // 7.2) gdata::DownloadFileOperation overrides the default implementations 250 // 7.2) gdata::DownloadFileOperation overrides the default implementations
251 // of the following methods of net::URLFetcherDelegate: 251 // of the following methods of net::URLFetcherDelegate:
252 // - ShouldSendDownloadData(): returns true for non-null 252 // - ShouldSendDownloadData(): returns true for non-null
253 // GetDownloadDataCallback. 253 // GetDownloadDataCallback.
254 // - OnURLFetchDownloadData(): invokes non-null 254 // - OnURLFetchDownloadData(): invokes non-null
255 // GetDownloadDataCallback 255 // GetDownloadDataCallback
256 // 7.3) GDataProtolHandler::OnURLFetchDownloadData (i.e. this class) 256 // 7.3) GDataProtolHandler::OnURLFetchDownloadData (i.e. this class)
257 // is at the end of the invocation chain and actually implements the 257 // is at the end of the invocation chain and actually implements the
258 // method. 258 // method.
259 // 7.4) Copies the formal download data into a growable-drainable dowload 259 // 7.4) Copies the formal download data into a growable-drainable dowload
260 // IOBuffer 260 // IOBuffer
261 // - IOBuffer has initial size 4096, same as buffer used in 261 // - IOBuffer has initial size 4096, same as buffer used in
262 // content::URLFetcherCore::OnReadCompleted. 262 // net::URLFetcherCore::OnReadCompleted.
263 // - We may end up with multiple chunks, so we use GrowableIOBuffer. 263 // - We may end up with multiple chunks, so we use GrowableIOBuffer.
264 // - We then wrap the growable buffer within a DrainableIOBuffer for 264 // - We then wrap the growable buffer within a DrainableIOBuffer for
265 // ease of progressively writing into the buffer. 265 // ease of progressively writing into the buffer.
266 // 7.5) When we receive the very first chunk of data, notify start success. 266 // 7.5) When we receive the very first chunk of data, notify start success.
267 // 7.6) Proceed to streaming of download data in ReadRawData. 267 // 7.6) Proceed to streaming of download data in ReadRawData.
268 // 8) If file exits in cache: 268 // 8) If file exits in cache:
269 // 8.1) in get-file callback, post task to get file size of local file. 269 // 8.1) in get-file callback, post task to get file size of local file.
270 // 8.2) In get-file-size callback, record file size and notify success. 270 // 8.2) In get-file-size callback, record file size and notify success.
271 // 8.3) Proceed to reading from file in ReadRawData. 271 // 8.3) Proceed to reading from file in ReadRawData.
272 // Any error arising from steps 4-8, immediately report start error and bail 272 // Any error arising from steps 4-8, immediately report start error and bail
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 GDataProtocolHandler::~GDataProtocolHandler() { 903 GDataProtocolHandler::~GDataProtocolHandler() {
904 } 904 }
905 905
906 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( 906 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob(
907 net::URLRequest* request) const { 907 net::URLRequest* request) const {
908 DVLOG(1) << "Handling url: " << request->url().spec(); 908 DVLOG(1) << "Handling url: " << request->url().spec();
909 return new GDataURLRequestJob(request); 909 return new GDataURLRequestJob(request);
910 } 910 }
911 911
912 } // namespace gdata 912 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_operations.cc ('k') | chrome/browser/chromeos/imageburner/burn_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698