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/drive/drive_system_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_system_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/drive/drive_api_service.h" | |
11 #include "chrome/browser/chromeos/drive/drive_download_observer.h" | 10 #include "chrome/browser/chromeos/drive/drive_download_observer.h" |
12 #include "chrome/browser/chromeos/drive/drive_file_system.h" | 11 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
13 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h" | 12 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h" |
14 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 13 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
15 #include "chrome/browser/chromeos/drive/drive_prefetcher.h" | 14 #include "chrome/browser/chromeos/drive/drive_prefetcher.h" |
16 #include "chrome/browser/chromeos/drive/drive_sync_client.h" | 15 #include "chrome/browser/chromeos/drive/drive_sync_client.h" |
17 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" | 16 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" |
18 #include "chrome/browser/chromeos/drive/event_logger.h" | 17 #include "chrome/browser/chromeos/drive/event_logger.h" |
19 #include "chrome/browser/chromeos/drive/file_write_helper.h" | 18 #include "chrome/browser/chromeos/drive/file_write_helper.h" |
20 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h" | 19 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h" |
21 #include "chrome/browser/download/download_service.h" | 20 #include "chrome/browser/download/download_service.h" |
22 #include "chrome/browser/download/download_service_factory.h" | 21 #include "chrome/browser/download/download_service_factory.h" |
23 #include "chrome/browser/download/download_util.h" | 22 #include "chrome/browser/download/download_util.h" |
| 23 #include "chrome/browser/google_apis/drive_api_service.h" |
24 #include "chrome/browser/google_apis/drive_api_util.h" | 24 #include "chrome/browser/google_apis/drive_api_util.h" |
25 #include "chrome/browser/google_apis/drive_uploader.h" | 25 #include "chrome/browser/google_apis/drive_uploader.h" |
26 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 26 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
27 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 27 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/profiles/profile_dependency_manager.h" | 30 #include "chrome/browser/profiles/profile_dependency_manager.h" |
31 #include "chrome/browser/sync/profile_sync_service.h" | 31 #include "chrome/browser/sync/profile_sync_service.h" |
32 #include "chrome/browser/sync/profile_sync_service_factory.h" | 32 #include "chrome/browser/sync/profile_sync_service_factory.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 115 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
117 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); | 117 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); |
118 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( | 118 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( |
119 blocking_pool->GetSequenceToken()); | 119 blocking_pool->GetSequenceToken()); |
120 | 120 |
121 event_logger_.reset(new EventLogger(kEventLogHistorySize)); | 121 event_logger_.reset(new EventLogger(kEventLogHistorySize)); |
122 if (test_drive_service) { | 122 if (test_drive_service) { |
123 drive_service_.reset(test_drive_service); | 123 drive_service_.reset(test_drive_service); |
124 } else if (google_apis::util::IsDriveV2ApiEnabled()) { | 124 } else if (google_apis::util::IsDriveV2ApiEnabled()) { |
125 drive_service_.reset(new DriveAPIService( | 125 drive_service_.reset(new google_apis::DriveAPIService( |
126 g_browser_process->system_request_context(), | 126 g_browser_process->system_request_context(), |
127 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), | 127 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), |
128 GetDriveUserAgent())); | 128 GetDriveUserAgent())); |
129 } else { | 129 } else { |
130 drive_service_.reset(new google_apis::GDataWapiService( | 130 drive_service_.reset(new google_apis::GDataWapiService( |
131 g_browser_process->system_request_context(), | 131 g_browser_process->system_request_context(), |
132 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), | 132 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), |
133 GetDriveUserAgent())); | 133 GetDriveUserAgent())); |
134 } | 134 } |
135 cache_.reset(new DriveCache(!test_cache_root.empty() ? test_cache_root : | 135 cache_.reset(new DriveCache(!test_cache_root.empty() ? test_cache_root : |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 if (factory_for_test_.is_null()) | 410 if (factory_for_test_.is_null()) |
411 service = new DriveSystemService(profile, NULL, FilePath(), NULL); | 411 service = new DriveSystemService(profile, NULL, FilePath(), NULL); |
412 else | 412 else |
413 service = factory_for_test_.Run(profile); | 413 service = factory_for_test_.Run(profile); |
414 | 414 |
415 service->Initialize(); | 415 service->Initialize(); |
416 return service; | 416 return service; |
417 } | 417 } |
418 | 418 |
419 } // namespace drive | 419 } // namespace drive |
OLD | NEW |