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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 base::Bind(&GDataURLRequestJob::OnGetEntryInfoByResourceId, | 504 base::Bind(&GDataURLRequestJob::OnGetEntryInfoByResourceId, |
505 weak_ptr_factory_->GetWeakPtr(), | 505 weak_ptr_factory_->GetWeakPtr(), |
506 resource_id)); | 506 resource_id)); |
507 } | 507 } |
508 | 508 |
509 void GDataURLRequestJob::OnGetEntryInfoByResourceId( | 509 void GDataURLRequestJob::OnGetEntryInfoByResourceId( |
510 const std::string& resource_id, | 510 const std::string& resource_id, |
511 GDataFileError error, | 511 GDataFileError error, |
512 const FilePath& gdata_file_path, | 512 const FilePath& gdata_file_path, |
513 scoped_ptr<GDataEntryProto> entry_proto) { | 513 scoped_ptr<GDataEntryProto> entry_proto) { |
514 if (!entry_proto->has_file_specific_info()) | 514 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
515 error = GDATA_FILE_ERROR_NOT_FOUND; | 515 error = GDATA_FILE_ERROR_NOT_FOUND; |
516 | 516 |
517 if (error == GDATA_FILE_OK) { | 517 if (error == GDATA_FILE_OK) { |
518 DCHECK(entry_proto.get()); | 518 DCHECK(entry_proto.get()); |
519 mime_type_ = entry_proto->file_specific_info().content_mime_type(); | 519 mime_type_ = entry_proto->file_specific_info().content_mime_type(); |
520 gdata_file_path_ = gdata_file_path; | 520 gdata_file_path_ = gdata_file_path; |
521 initial_file_size_ = entry_proto->file_info().size(); | 521 initial_file_size_ = entry_proto->file_info().size(); |
522 } else { | 522 } else { |
523 mime_type_.clear(); | 523 mime_type_.clear(); |
524 gdata_file_path_.clear(); | 524 gdata_file_path_.clear(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 GDataProtocolHandler::~GDataProtocolHandler() { | 933 GDataProtocolHandler::~GDataProtocolHandler() { |
934 } | 934 } |
935 | 935 |
936 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( | 936 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( |
937 net::URLRequest* request) const { | 937 net::URLRequest* request) const { |
938 DVLOG(1) << "Handling url: " << request->url().spec(); | 938 DVLOG(1) << "Handling url: " << request->url().spec(); |
939 return new GDataURLRequestJob(request); | 939 return new GDataURLRequestJob(request); |
940 } | 940 } |
941 | 941 |
942 } // namespace gdata | 942 } // namespace gdata |
OLD | NEW |