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 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 system_service->cache()->GetCacheEntryOnUIThread( | 1855 system_service->cache()->GetCacheEntryOnUIThread( |
1856 file_proto->gdata_entry().resource_id(), | 1856 file_proto->gdata_entry().resource_id(), |
1857 file_proto->file_md5(), | 1857 file_proto->file_md5(), |
1858 base::Bind( | 1858 base::Bind( |
1859 &GetGDataFilePropertiesFunction::CacheStateReceived, | 1859 &GetGDataFilePropertiesFunction::CacheStateReceived, |
1860 this, property_dict)); | 1860 this, property_dict)); |
1861 } | 1861 } |
1862 | 1862 |
1863 void GetGDataFilePropertiesFunction::CacheStateReceived( | 1863 void GetGDataFilePropertiesFunction::CacheStateReceived( |
1864 base::DictionaryValue* property_dict, | 1864 base::DictionaryValue* property_dict, |
1865 bool success, | 1865 bool /* success */, |
1866 const gdata::GDataCache::CacheEntry& cache_entry) { | 1866 const gdata::GDataCache::CacheEntry& cache_entry) { |
1867 const int cache_state = (success ? cache_entry.cache_state : | 1867 // In case of an error (i.e. success is false), cache_entry.cache_state is |
1868 gdata::GDataCache::CACHE_STATE_NONE); | 1868 // set to CACHE_STATE_NONE. |
1869 property_dict->SetBoolean( | 1869 property_dict->SetBoolean("isPinned", cache_entry.IsPinned()); |
1870 "isPinned", | 1870 property_dict->SetBoolean("isPresent", cache_entry.IsPresent()); |
1871 gdata::GDataCache::IsCachePinned(cache_state)); | 1871 property_dict->SetBoolean("isDirty", cache_entry.IsDirty()); |
1872 | 1872 |
1873 property_dict->SetBoolean( | |
1874 "isPresent", | |
1875 gdata::GDataCache::IsCachePresent(cache_state)); | |
1876 | |
1877 property_dict->SetBoolean( | |
1878 "isDirty", | |
1879 gdata::GDataCache::IsCacheDirty(cache_state)); | |
1880 CompleteGetFileProperties(); | 1873 CompleteGetFileProperties(); |
1881 } | 1874 } |
1882 | 1875 |
1883 PinGDataFileFunction::PinGDataFileFunction() { | 1876 PinGDataFileFunction::PinGDataFileFunction() { |
1884 } | 1877 } |
1885 | 1878 |
1886 PinGDataFileFunction::~PinGDataFileFunction() { | 1879 PinGDataFileFunction::~PinGDataFileFunction() { |
1887 } | 1880 } |
1888 | 1881 |
1889 bool PinGDataFileFunction::RunImpl() { | 1882 bool PinGDataFileFunction::RunImpl() { |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 gdata::GDataSystemService* system_service = | 2400 gdata::GDataSystemService* system_service = |
2408 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2401 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2409 if (!system_service || !system_service->file_system()) | 2402 if (!system_service || !system_service->file_system()) |
2410 return false; | 2403 return false; |
2411 | 2404 |
2412 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2405 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2413 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2406 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2414 | 2407 |
2415 return true; | 2408 return true; |
2416 } | 2409 } |
OLD | NEW |