| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/string_split.h" | 14 #include "base/string_split.h" |
| 15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/chromeos/cros/cros_library.h" | 18 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 19 #include "chrome/browser/chromeos/cros/network_library.h" | 19 #include "chrome/browser/chromeos/cros/network_library.h" |
| 20 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" | 20 #include "chrome/browser/chromeos/disks/disk_mount_manager.h" |
| 21 #include "chrome/browser/chromeos/extensions/file_handler_util.h" | 21 #include "chrome/browser/chromeos/extensions/file_handler_util.h" |
| 22 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 22 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| 23 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 23 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 24 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 24 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
| 25 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
| 25 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" | 26 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
| 26 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | 27 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
| 27 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 28 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 28 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 29 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 29 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 30 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 30 #include "chrome/browser/extensions/extension_process_manager.h" | 31 #include "chrome/browser/extensions/extension_process_manager.h" |
| 31 #include "chrome/browser/extensions/extension_service.h" | 32 #include "chrome/browser/extensions/extension_service.h" |
| 32 #include "chrome/browser/extensions/extension_tab_util.h" | 33 #include "chrome/browser/extensions/extension_tab_util.h" |
| 33 #include "chrome/browser/extensions/process_map.h" | 34 #include "chrome/browser/extensions/process_map.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 | 1856 |
| 1856 GetFileTransfersFunction::~GetFileTransfersFunction() {} | 1857 GetFileTransfersFunction::~GetFileTransfersFunction() {} |
| 1857 | 1858 |
| 1858 ListValue* GetFileTransfersFunction::GetFileTransfersList() { | 1859 ListValue* GetFileTransfersFunction::GetFileTransfersList() { |
| 1859 gdata::GDataSystemService* system_service = | 1860 gdata::GDataSystemService* system_service = |
| 1860 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 1861 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
| 1861 if (!system_service) | 1862 if (!system_service) |
| 1862 return NULL; | 1863 return NULL; |
| 1863 | 1864 |
| 1864 std::vector<gdata::GDataOperationRegistry::ProgressStatus> | 1865 std::vector<gdata::GDataOperationRegistry::ProgressStatus> |
| 1865 list = system_service->file_system()->GetOperationRegistry()-> | 1866 list = system_service->docs_service()->operation_registry()-> |
| 1866 GetProgressStatusList(); | 1867 GetProgressStatusList(); |
| 1867 return file_manager_util::ProgressStatusVectorToListValue( | 1868 return file_manager_util::ProgressStatusVectorToListValue( |
| 1868 profile_, source_url_.GetOrigin(), list); | 1869 profile_, source_url_.GetOrigin(), list); |
| 1869 } | 1870 } |
| 1870 | 1871 |
| 1871 bool GetFileTransfersFunction::RunImpl() { | 1872 bool GetFileTransfersFunction::RunImpl() { |
| 1872 scoped_ptr<ListValue> progress_status_list(GetFileTransfersList()); | 1873 scoped_ptr<ListValue> progress_status_list(GetFileTransfersList()); |
| 1873 if (!progress_status_list.get()) { | 1874 if (!progress_status_list.get()) { |
| 1874 SendResponse(false); | 1875 SendResponse(false); |
| 1875 return false; | 1876 return false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 const SelectedFileInfoList& files) { | 1913 const SelectedFileInfoList& files) { |
| 1913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1914 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1914 gdata::GDataSystemService* system_service = | 1915 gdata::GDataSystemService* system_service = |
| 1915 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 1916 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
| 1916 if (!system_service) { | 1917 if (!system_service) { |
| 1917 SendResponse(false); | 1918 SendResponse(false); |
| 1918 return; | 1919 return; |
| 1919 } | 1920 } |
| 1920 | 1921 |
| 1921 gdata::GDataOperationRegistry* operation_registry = | 1922 gdata::GDataOperationRegistry* operation_registry = |
| 1922 system_service->file_system()->GetOperationRegistry(); | 1923 system_service->docs_service()->operation_registry(); |
| 1923 | 1924 |
| 1924 scoped_ptr<ListValue> responses(new ListValue()); | 1925 scoped_ptr<ListValue> responses(new ListValue()); |
| 1925 for (size_t i = 0; i < files.size(); ++i) { | 1926 for (size_t i = 0; i < files.size(); ++i) { |
| 1926 DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].path)); | 1927 DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].path)); |
| 1927 FilePath file_path = gdata::util::ExtractGDataPath(files[i].path); | 1928 FilePath file_path = gdata::util::ExtractGDataPath(files[i].path); |
| 1928 scoped_ptr<DictionaryValue> result(new DictionaryValue()); | 1929 scoped_ptr<DictionaryValue> result(new DictionaryValue()); |
| 1929 result->SetBoolean( | 1930 result->SetBoolean( |
| 1930 "canceled", | 1931 "canceled", |
| 1931 operation_registry->CancelForFilePath(file_path)); | 1932 operation_registry->CancelForFilePath(file_path)); |
| 1932 GURL file_url; | 1933 GURL file_url; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 gdata::GDataSystemService* system_service = | 2130 gdata::GDataSystemService* system_service = |
| 2130 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2131 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
| 2131 if (!system_service || !system_service->file_system()) | 2132 if (!system_service || !system_service->file_system()) |
| 2132 return false; | 2133 return false; |
| 2133 | 2134 |
| 2134 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2135 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
| 2135 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2136 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
| 2136 | 2137 |
| 2137 return true; | 2138 return true; |
| 2138 } | 2139 } |
| OLD | NEW |