| 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 "base/command_line.h" |
| 9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/download/download_service.h" | 11 #include "chrome/browser/download/download_service.h" |
| 11 #include "chrome/browser/download/download_service_factory.h" | 12 #include "chrome/browser/download/download_service_factory.h" |
| 12 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" | 13 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" |
| 13 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 16 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 17 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
| 17 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" | 18 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 19 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| 19 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 20 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_dependency_manager.h" | 22 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 23 #include "chrome/common/chrome_switches.h" |
| 22 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 24 #include "webkit/fileapi/file_system_context.h" | 26 #include "webkit/fileapi/file_system_context.h" |
| 25 #include "webkit/fileapi/file_system_mount_point_provider.h" | 27 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 26 | 28 |
| 27 using content::BrowserContext; | 29 using content::BrowserContext; |
| 28 using content::BrowserThread; | 30 using content::BrowserThread; |
| 29 | 31 |
| 30 namespace gdata { | 32 namespace gdata { |
| 31 | 33 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 } | 58 } |
| 57 | 59 |
| 58 GDataSystemService::~GDataSystemService() { | 60 GDataSystemService::~GDataSystemService() { |
| 59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 60 cache_->DestroyOnUIThread(); | 62 cache_->DestroyOnUIThread(); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void GDataSystemService::Initialize() { | 65 void GDataSystemService::Initialize() { |
| 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 65 | 67 |
| 68 |
| 69 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 70 switches::kEnableDriveV2Api)) { |
| 71 DVLOG(1) << "Using Drive v2 API."; |
| 72 use_drive_api_ = true; |
| 73 } |
| 74 |
| 66 sync_client_->Initialize(); | 75 sync_client_->Initialize(); |
| 67 file_system_->Initialize(); | 76 file_system_->Initialize(use_drive_api_); |
| 68 cache_->RequestInitializeOnUIThread(); | 77 cache_->RequestInitializeOnUIThread(); |
| 69 | 78 |
| 70 content::DownloadManager* download_manager = | 79 content::DownloadManager* download_manager = |
| 71 g_browser_process->download_status_updater() ? | 80 g_browser_process->download_status_updater() ? |
| 72 BrowserContext::GetDownloadManager(profile_) : NULL; | 81 BrowserContext::GetDownloadManager(profile_) : NULL; |
| 73 download_observer_->Initialize( | 82 download_observer_->Initialize( |
| 74 uploader_.get(), | 83 uploader_.get(), |
| 75 download_manager, | 84 download_manager, |
| 76 cache_->GetCacheDirectoryPath( | 85 cache_->GetCacheDirectoryPath( |
| 77 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); | 86 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 154 } |
| 146 | 155 |
| 147 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( | 156 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( |
| 148 Profile* profile) const { | 157 Profile* profile) const { |
| 149 GDataSystemService* service = new GDataSystemService(profile); | 158 GDataSystemService* service = new GDataSystemService(profile); |
| 150 service->Initialize(); | 159 service->Initialize(); |
| 151 return service; | 160 return service; |
| 152 } | 161 } |
| 153 | 162 |
| 154 } // namespace gdata | 163 } // namespace gdata |
| OLD | NEW |