Chromium Code Reviews| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 BrowserThread::UI, | 316 BrowserThread::UI, |
| 317 FROM_HERE, | 317 FROM_HERE, |
| 318 base::Bind(&CancelGDataDownloadOnUIThread, | 318 base::Bind(&CancelGDataDownloadOnUIThread, |
| 319 gdata_file_path_)); | 319 gdata_file_path_)); |
| 320 } | 320 } |
| 321 | 321 |
| 322 net::URLRequestJob::Kill(); | 322 net::URLRequestJob::Kill(); |
| 323 weak_ptr_factory_->InvalidateWeakPtrs(); | 323 weak_ptr_factory_->InvalidateWeakPtrs(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 const struct MimeTypeReplacement { | |
|
Greg Spencer (Chromium)
2012/06/20 16:44:56
Can you move this to the top of the file, under kI
tudalex(Chromium)
2012/06/20 18:20:30
Done.
| |
| 327 const char* original_type; | |
| 328 const char* new_type; | |
|
Greg Spencer (Chromium)
2012/06/20 16:44:56
Can you please split this into a struct definition
tudalex(Chromium)
2012/06/20 18:20:30
Done.
| |
| 329 } kMimeTypeReplacements[] = { | |
| 330 {"message/rfc822","multipart/related"} | |
| 331 }; | |
| 332 | |
| 333 std::string FixupMimeType(const std::string& type) { | |
|
Greg Spencer (Chromium)
2012/06/20 16:44:56
Since this isn't a member of the class here, can y
tudalex(Chromium)
2012/06/20 18:20:30
Done.
| |
| 334 for (size_t i = 0; i < arraysize(kMimeTypeReplacements); i++) { | |
| 335 if (type == kMimeTypeReplacements[i].original_type) | |
| 336 return kMimeTypeReplacements[i].new_type; | |
| 337 } | |
| 338 return type; | |
| 339 } | |
| 340 | |
| 326 bool GDataURLRequestJob::GetMimeType(std::string* mime_type) const { | 341 bool GDataURLRequestJob::GetMimeType(std::string* mime_type) const { |
| 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 342 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 328 mime_type->assign(mime_type_); | 343 mime_type->assign(FixupMimeType(mime_type_)); |
| 329 return !mime_type->empty(); | 344 return !mime_type->empty(); |
| 330 } | 345 } |
| 331 | 346 |
| 332 void GDataURLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { | 347 void GDataURLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { |
| 333 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 348 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 334 if (response_info_.get()) | 349 if (response_info_.get()) |
| 335 *info = *response_info_; | 350 *info = *response_info_; |
| 336 } | 351 } |
| 337 | 352 |
| 338 int GDataURLRequestJob::GetResponseCode() const { | 353 int GDataURLRequestJob::GetResponseCode() const { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 GDataProtocolHandler::~GDataProtocolHandler() { | 918 GDataProtocolHandler::~GDataProtocolHandler() { |
| 904 } | 919 } |
| 905 | 920 |
| 906 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( | 921 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( |
| 907 net::URLRequest* request) const { | 922 net::URLRequest* request) const { |
| 908 DVLOG(1) << "Handling url: " << request->url().spec(); | 923 DVLOG(1) << "Handling url: " << request->url().spec(); |
| 909 return new GDataURLRequestJob(request); | 924 return new GDataURLRequestJob(request); |
| 910 } | 925 } |
| 911 | 926 |
| 912 } // namespace gdata | 927 } // namespace gdata |
| OLD | NEW |