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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1818 | 1818 |
1819 GetFileTransfersFunction::~GetFileTransfersFunction() {} | 1819 GetFileTransfersFunction::~GetFileTransfersFunction() {} |
1820 | 1820 |
1821 ListValue* GetFileTransfersFunction::GetFileTransfersList() { | 1821 ListValue* GetFileTransfersFunction::GetFileTransfersList() { |
1822 gdata::GDataSystemService* system_service = | 1822 gdata::GDataSystemService* system_service = |
1823 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 1823 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
1824 if (!system_service) | 1824 if (!system_service) |
1825 return NULL; | 1825 return NULL; |
1826 | 1826 |
1827 std::vector<gdata::GDataOperationRegistry::ProgressStatus> | 1827 std::vector<gdata::GDataOperationRegistry::ProgressStatus> |
1828 list = system_service->file_system()->GetProgressStatusList(); | 1828 list = system_service->file_system()->GetOperationRegistry()-> |
1829 GetProgressStatusList(); | |
1829 return file_manager_util::ProgressStatusVectorToListValue( | 1830 return file_manager_util::ProgressStatusVectorToListValue( |
1830 profile_, source_url_.GetOrigin(), list); | 1831 profile_, source_url_.GetOrigin(), list); |
1831 } | 1832 } |
1832 | 1833 |
1833 bool GetFileTransfersFunction::RunImpl() { | 1834 bool GetFileTransfersFunction::RunImpl() { |
1834 scoped_ptr<ListValue> progress_status_list(GetFileTransfersList()); | 1835 scoped_ptr<ListValue> progress_status_list(GetFileTransfersList()); |
1835 if (!progress_status_list.get()) { | 1836 if (!progress_status_list.get()) { |
1836 SendResponse(false); | 1837 SendResponse(false); |
1837 return false; | 1838 return false; |
1838 } | 1839 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1873 void CancelFileTransfersFunction::GetLocalPathsResponseOnUIThread( | 1874 void CancelFileTransfersFunction::GetLocalPathsResponseOnUIThread( |
1874 const SelectedFileInfoList& files) { | 1875 const SelectedFileInfoList& files) { |
1875 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1876 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1876 gdata::GDataSystemService* system_service = | 1877 gdata::GDataSystemService* system_service = |
1877 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 1878 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
1878 if (!system_service) { | 1879 if (!system_service) { |
1879 SendResponse(false); | 1880 SendResponse(false); |
1880 return; | 1881 return; |
1881 } | 1882 } |
1882 | 1883 |
1884 gdata::GDataOperationRegistry* operation_registry = | |
achuithb
2012/04/24 00:16:22
can any of these be NULL?
satorux1
2012/04/24 06:15:25
no. as long as system_service is non-null, the fil
| |
1885 system_service->file_system()->GetOperationRegistry(); | |
1886 | |
1883 scoped_ptr<ListValue> responses(new ListValue()); | 1887 scoped_ptr<ListValue> responses(new ListValue()); |
1884 for (size_t i = 0; i < files.size(); ++i) { | 1888 for (size_t i = 0; i < files.size(); ++i) { |
1885 DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].path)); | 1889 DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].path)); |
1886 FilePath file_path = gdata::util::ExtractGDataPath(files[i].path); | 1890 FilePath file_path = gdata::util::ExtractGDataPath(files[i].path); |
1887 scoped_ptr<DictionaryValue> result(new DictionaryValue()); | 1891 scoped_ptr<DictionaryValue> result(new DictionaryValue()); |
1888 result->SetBoolean( | 1892 result->SetBoolean( |
1889 "canceled", | 1893 "canceled", |
1890 system_service->file_system()->CancelOperation(file_path)); | 1894 operation_registry->CancelForFilePath(file_path)); |
1891 GURL file_url; | 1895 GURL file_url; |
1892 if (file_manager_util::ConvertFileToFileSystemUrl(profile_, | 1896 if (file_manager_util::ConvertFileToFileSystemUrl(profile_, |
1893 gdata::util::GetSpecialRemoteRootPath().Append(file_path), | 1897 gdata::util::GetSpecialRemoteRootPath().Append(file_path), |
1894 source_url_.GetOrigin(), | 1898 source_url_.GetOrigin(), |
1895 &file_url)) { | 1899 &file_url)) { |
1896 result->SetString("fileUrl", file_url.spec()); | 1900 result->SetString("fileUrl", file_url.spec()); |
1897 } | 1901 } |
1898 | 1902 |
1899 responses->Append(result.release()); | 1903 responses->Append(result.release()); |
1900 } | 1904 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1998 if (value->GetBoolean("cellularDisabled", &tmp)) { | 2002 if (value->GetBoolean("cellularDisabled", &tmp)) { |
1999 service->SetBoolean(prefs::kDisableGDataOverCellular, tmp); | 2003 service->SetBoolean(prefs::kDisableGDataOverCellular, tmp); |
2000 } | 2004 } |
2001 | 2005 |
2002 if (value->GetBoolean("hostedFilesDisabled", &tmp)) { | 2006 if (value->GetBoolean("hostedFilesDisabled", &tmp)) { |
2003 service->SetBoolean(prefs::kDisableGDataHostedFiles, tmp); | 2007 service->SetBoolean(prefs::kDisableGDataHostedFiles, tmp); |
2004 } | 2008 } |
2005 | 2009 |
2006 return true; | 2010 return true; |
2007 } | 2011 } |
OLD | NEW |