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/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.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/documents_service_interface.h" | 23 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
24 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 24 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
25 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 25 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
26 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" | 26 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
27 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 27 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
28 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 28 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
29 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | 29 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" |
30 #include "chrome/browser/chromeos/system/statistics_provider.h" | 30 #include "chrome/browser/chromeos/system/statistics_provider.h" |
31 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 31 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
32 #include "chrome/browser/extensions/extension_process_manager.h" | 32 #include "chrome/browser/extensions/extension_process_manager.h" |
33 #include "chrome/browser/extensions/extension_service.h" | 33 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 | 2100 |
2101 GetFileTransfersFunction::~GetFileTransfersFunction() {} | 2101 GetFileTransfersFunction::~GetFileTransfersFunction() {} |
2102 | 2102 |
2103 ListValue* GetFileTransfersFunction::GetFileTransfersList() { | 2103 ListValue* GetFileTransfersFunction::GetFileTransfersList() { |
2104 gdata::GDataSystemService* system_service = | 2104 gdata::GDataSystemService* system_service = |
2105 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2105 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2106 if (!system_service) | 2106 if (!system_service) |
2107 return NULL; | 2107 return NULL; |
2108 | 2108 |
2109 std::vector<gdata::GDataOperationRegistry::ProgressStatus> | 2109 std::vector<gdata::GDataOperationRegistry::ProgressStatus> |
2110 list = system_service->docs_service()->operation_registry()-> | 2110 list = system_service->drive_service()->operation_registry()-> |
2111 GetProgressStatusList(); | 2111 GetProgressStatusList(); |
2112 return file_manager_util::ProgressStatusVectorToListValue( | 2112 return file_manager_util::ProgressStatusVectorToListValue( |
2113 profile_, source_url_.GetOrigin(), list); | 2113 profile_, source_url_.GetOrigin(), list); |
2114 } | 2114 } |
2115 | 2115 |
2116 bool GetFileTransfersFunction::RunImpl() { | 2116 bool GetFileTransfersFunction::RunImpl() { |
2117 scoped_ptr<ListValue> progress_status_list(GetFileTransfersList()); | 2117 scoped_ptr<ListValue> progress_status_list(GetFileTransfersList()); |
2118 if (!progress_status_list.get()) { | 2118 if (!progress_status_list.get()) { |
2119 SendResponse(false); | 2119 SendResponse(false); |
2120 return false; | 2120 return false; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 const SelectedFileInfoList& files) { | 2157 const SelectedFileInfoList& files) { |
2158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2159 gdata::GDataSystemService* system_service = | 2159 gdata::GDataSystemService* system_service = |
2160 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2160 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2161 if (!system_service) { | 2161 if (!system_service) { |
2162 SendResponse(false); | 2162 SendResponse(false); |
2163 return; | 2163 return; |
2164 } | 2164 } |
2165 | 2165 |
2166 gdata::GDataOperationRegistry* operation_registry = | 2166 gdata::GDataOperationRegistry* operation_registry = |
2167 system_service->docs_service()->operation_registry(); | 2167 system_service->drive_service()->operation_registry(); |
2168 | 2168 |
2169 scoped_ptr<ListValue> responses(new ListValue()); | 2169 scoped_ptr<ListValue> responses(new ListValue()); |
2170 for (size_t i = 0; i < files.size(); ++i) { | 2170 for (size_t i = 0; i < files.size(); ++i) { |
2171 DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].file_path)); | 2171 DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].file_path)); |
2172 FilePath file_path = gdata::util::ExtractGDataPath(files[i].file_path); | 2172 FilePath file_path = gdata::util::ExtractGDataPath(files[i].file_path); |
2173 scoped_ptr<DictionaryValue> result(new DictionaryValue()); | 2173 scoped_ptr<DictionaryValue> result(new DictionaryValue()); |
2174 result->SetBoolean( | 2174 result->SetBoolean( |
2175 "canceled", | 2175 "canceled", |
2176 operation_registry->CancelForFilePath(file_path)); | 2176 operation_registry->CancelForFilePath(file_path)); |
2177 GURL file_url; | 2177 GURL file_url; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 gdata::GDataSystemService* system_service = | 2432 gdata::GDataSystemService* system_service = |
2433 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2433 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2434 if (!system_service || !system_service->file_system()) | 2434 if (!system_service || !system_service->file_system()) |
2435 return false; | 2435 return false; |
2436 | 2436 |
2437 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2437 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2438 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2438 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2439 | 2439 |
2440 return true; | 2440 return true; |
2441 } | 2441 } |
OLD | NEW |