| 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/gdata/gdata_system_service.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/gdata/drive_api_service.h" |
| 10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 11 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 11 #include "chrome/browser/chromeos/gdata/file_write_helper.h" | 12 #include "chrome/browser/chromeos/gdata/file_write_helper.h" |
| 12 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_contacts_service.h" |
| 13 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | |
| 14 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 20 #include "chrome/browser/chromeos/gdata/gdata_wapi_service.h" |
| 20 #include "chrome/browser/download/download_service.h" | 21 #include "chrome/browser/download/download_service.h" |
| 21 #include "chrome/browser/download/download_service_factory.h" | 22 #include "chrome/browser/download/download_service_factory.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_dependency_manager.h" | 24 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 24 #include "content/public/browser/browser_context.h" | 25 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "webkit/fileapi/file_system_context.h" | 27 #include "webkit/fileapi/file_system_context.h" |
| 27 #include "webkit/fileapi/file_system_mount_point_provider.h" | 28 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 28 | 29 |
| 29 using content::BrowserContext; | 30 using content::BrowserContext; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const std::string& cache_root) { | 203 const std::string& cache_root) { |
| 203 if (g_test_cache_root) | 204 if (g_test_cache_root) |
| 204 delete g_test_cache_root; | 205 delete g_test_cache_root; |
| 205 g_test_cache_root = !cache_root.empty() ? new std::string(cache_root) : NULL; | 206 g_test_cache_root = !cache_root.empty() ? new std::string(cache_root) : NULL; |
| 206 } | 207 } |
| 207 | 208 |
| 208 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( | 209 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( |
| 209 Profile* profile) const { | 210 Profile* profile) const { |
| 210 GDataSystemService* service = new GDataSystemService(profile); | 211 GDataSystemService* service = new GDataSystemService(profile); |
| 211 | 212 |
| 212 DocumentsServiceInterface* documents_service = | 213 DocumentsServiceInterface* documents_service = g_test_documents_service; |
| 213 g_test_documents_service ? g_test_documents_service : | |
| 214 new DocumentsService(); | |
| 215 g_test_documents_service = NULL; | 214 g_test_documents_service = NULL; |
| 215 if (!documents_service) { |
| 216 if (util::IsDriveV2ApiEnabled()) |
| 217 documents_service = new DriveAPIService(); |
| 218 else |
| 219 documents_service = new GDataWapiService(); |
| 220 } |
| 216 | 221 |
| 217 FilePath cache_root = | 222 FilePath cache_root = |
| 218 g_test_cache_root ? FilePath(*g_test_cache_root) : | 223 g_test_cache_root ? FilePath(*g_test_cache_root) : |
| 219 GDataCache::GetCacheRootPath(profile); | 224 GDataCache::GetCacheRootPath(profile); |
| 220 delete g_test_cache_root; | 225 delete g_test_cache_root; |
| 221 g_test_cache_root = NULL; | 226 g_test_cache_root = NULL; |
| 222 | 227 |
| 223 service->Initialize(documents_service, cache_root); | 228 service->Initialize(documents_service, cache_root); |
| 224 return service; | 229 return service; |
| 225 } | 230 } |
| 226 | 231 |
| 227 } // namespace gdata | 232 } // namespace gdata |
| OLD | NEW |