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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1817 GURL doc_icon = FindPreferredIcon(webapp_info->document_icons, | 1817 GURL doc_icon = FindPreferredIcon(webapp_info->document_icons, |
1818 kPreferredIconSize); | 1818 kPreferredIconSize); |
1819 if (!doc_icon.is_empty()) | 1819 if (!doc_icon.is_empty()) |
1820 app->SetString("docIcon", doc_icon.spec()); | 1820 app->SetString("docIcon", doc_icon.spec()); |
1821 app->SetString("objectType", webapp_info->object_type); | 1821 app->SetString("objectType", webapp_info->object_type); |
1822 app->SetBoolean("isPrimary", webapp_info->is_primary_selector); | 1822 app->SetBoolean("isPrimary", webapp_info->is_primary_selector); |
1823 apps->Append(app); | 1823 apps->Append(app); |
1824 } | 1824 } |
1825 } | 1825 } |
1826 | 1826 |
1827 system_service->file_system()->GetCacheState( | 1827 system_service->cache()->GetCacheEntryOnUIThread( |
1828 file_proto->gdata_entry().resource_id(), | 1828 file_proto->gdata_entry().resource_id(), |
1829 file_proto->file_md5(), | 1829 file_proto->file_md5(), |
1830 base::Bind( | 1830 base::Bind( |
1831 &GetGDataFilePropertiesFunction::CacheStateReceived, | 1831 &GetGDataFilePropertiesFunction::CacheStateReceived, |
1832 this, property_dict)); | 1832 this, property_dict)); |
1833 } | 1833 } |
1834 | 1834 |
1835 void GetGDataFilePropertiesFunction::CacheStateReceived( | 1835 void GetGDataFilePropertiesFunction::CacheStateReceived( |
1836 base::DictionaryValue* property_dict, | 1836 base::DictionaryValue* property_dict, |
1837 base::PlatformFileError error, | 1837 bool success, |
1838 int cache_state) { | 1838 const gdata::GDataCache::CacheEntry& cache_entry) { |
1839 property_dict->SetBoolean( | 1839 if (success) { |
hshi1
2012/06/28 22:11:21
Should any action be taken when (success == false)
satorux1
2012/06/28 22:41:17
Previously, cache_state was CACHE_STATE_NONE on er
| |
1840 "isPinned", | 1840 int cache_state = cache_entry.cache_state; |
1841 gdata::GDataCache::IsCachePinned(cache_state)); | 1841 property_dict->SetBoolean( |
1842 "isPinned", | |
1843 gdata::GDataCache::IsCachePinned(cache_state)); | |
1842 | 1844 |
1843 property_dict->SetBoolean( | 1845 property_dict->SetBoolean( |
1844 "isPresent", | 1846 "isPresent", |
1845 gdata::GDataCache::IsCachePresent(cache_state)); | 1847 gdata::GDataCache::IsCachePresent(cache_state)); |
1846 | 1848 |
1847 property_dict->SetBoolean( | 1849 property_dict->SetBoolean( |
1848 "isDirty", | 1850 "isDirty", |
1849 gdata::GDataCache::IsCacheDirty(cache_state)); | 1851 gdata::GDataCache::IsCacheDirty(cache_state)); |
1852 } | |
1850 CompleteGetFileProperties(); | 1853 CompleteGetFileProperties(); |
1851 } | 1854 } |
1852 | 1855 |
1853 PinGDataFileFunction::PinGDataFileFunction() { | 1856 PinGDataFileFunction::PinGDataFileFunction() { |
1854 } | 1857 } |
1855 | 1858 |
1856 PinGDataFileFunction::~PinGDataFileFunction() { | 1859 PinGDataFileFunction::~PinGDataFileFunction() { |
1857 } | 1860 } |
1858 | 1861 |
1859 bool PinGDataFileFunction::RunImpl() { | 1862 bool PinGDataFileFunction::RunImpl() { |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2377 gdata::GDataSystemService* system_service = | 2380 gdata::GDataSystemService* system_service = |
2378 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2381 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2379 if (!system_service || !system_service->file_system()) | 2382 if (!system_service || !system_service->file_system()) |
2380 return false; | 2383 return false; |
2381 | 2384 |
2382 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2385 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2383 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2386 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2384 | 2387 |
2385 return true; | 2388 return true; |
2386 } | 2389 } |
OLD | NEW |