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/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1810 Bind(&GetGDataFilePropertiesFunction::GetNextFileProperties, this)); | 1810 Bind(&GetGDataFilePropertiesFunction::GetNextFileProperties, this)); |
1811 } | 1811 } |
1812 | 1812 |
1813 void GetGDataFilePropertiesFunction::OnGetFileInfo( | 1813 void GetGDataFilePropertiesFunction::OnGetFileInfo( |
1814 const FilePath& file_path, | 1814 const FilePath& file_path, |
1815 base::DictionaryValue* property_dict, | 1815 base::DictionaryValue* property_dict, |
1816 gdata::GDataFileError error, | 1816 gdata::GDataFileError error, |
1817 scoped_ptr<gdata::GDataEntryProto> entry_proto) { | 1817 scoped_ptr<gdata::GDataEntryProto> entry_proto) { |
1818 DCHECK(property_dict); | 1818 DCHECK(property_dict); |
1819 | 1819 |
1820 if (!entry_proto->has_file_specific_info()) | 1820 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
achuithb
2012/07/23 18:52:23
Is this logic correct?
Shouldn't it be:
if (!entr
satorux1
2012/07/23 19:25:34
this logic is correct. if entry_proto.get() is nul
| |
1821 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; | 1821 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; |
1822 | 1822 |
1823 if (error == gdata::GDATA_FILE_OK) | 1823 if (error == gdata::GDATA_FILE_OK) |
1824 DoOperation(file_path, property_dict, entry_proto.Pass()); | 1824 DoOperation(file_path, property_dict, entry_proto.Pass()); |
1825 else | 1825 else |
1826 OnOperationComplete(file_path, property_dict, error, entry_proto.Pass()); | 1826 OnOperationComplete(file_path, property_dict, error, entry_proto.Pass()); |
1827 } | 1827 } |
1828 | 1828 |
1829 void GetGDataFilePropertiesFunction::OnOperationComplete( | 1829 void GetGDataFilePropertiesFunction::OnOperationComplete( |
1830 const FilePath& file_path, | 1830 const FilePath& file_path, |
1831 base::DictionaryValue* property_dict, | 1831 base::DictionaryValue* property_dict, |
1832 gdata::GDataFileError error, | 1832 gdata::GDataFileError error, |
1833 scoped_ptr<gdata::GDataEntryProto> entry_proto) { | 1833 scoped_ptr<gdata::GDataEntryProto> entry_proto) { |
1834 if (!entry_proto->has_file_specific_info()) | 1834 if (entry_proto.get() && !entry_proto->has_file_specific_info()) |
1835 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; | 1835 error = gdata::GDATA_FILE_ERROR_NOT_FOUND; |
1836 | 1836 |
1837 if (error != gdata::GDATA_FILE_OK) { | 1837 if (error != gdata::GDATA_FILE_OK) { |
1838 property_dict->SetInteger("errorCode", error); | 1838 property_dict->SetInteger("errorCode", error); |
1839 CompleteGetFileProperties(); | 1839 CompleteGetFileProperties(); |
1840 return; | 1840 return; |
1841 } | 1841 } |
1842 DCHECK(entry_proto.get()); | 1842 DCHECK(entry_proto.get()); |
1843 | 1843 |
1844 const gdata::GDataFileSpecificInfo& file_specific_info = | 1844 const gdata::GDataFileSpecificInfo& file_specific_info = |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2404 gdata::GDataSystemService* system_service = | 2404 gdata::GDataSystemService* system_service = |
2405 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2405 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2406 if (!system_service || !system_service->file_system()) | 2406 if (!system_service || !system_service->file_system()) |
2407 return false; | 2407 return false; |
2408 | 2408 |
2409 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2409 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2410 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2410 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2411 | 2411 |
2412 return true; | 2412 return true; |
2413 } | 2413 } |
OLD | NEW |