Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: chrome/browser/chromeos/drive/drive_system_service.cc

Issue 13448003: Narrow the ownership of DriveUploader from DriveSystemService to DriveScheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chromeos/drive/drive_download_handler.h" 11 #include "chrome/browser/chromeos/drive/drive_download_handler.h"
12 #include "chrome/browser/chromeos/drive/drive_file_system.h" 12 #include "chrome/browser/chromeos/drive/drive_file_system.h"
13 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h" 13 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h"
14 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 14 #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
15 #include "chrome/browser/chromeos/drive/drive_prefetcher.h" 15 #include "chrome/browser/chromeos/drive/drive_prefetcher.h"
16 #include "chrome/browser/chromeos/drive/drive_sync_client.h" 16 #include "chrome/browser/chromeos/drive/drive_sync_client.h"
17 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" 17 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h"
18 #include "chrome/browser/chromeos/drive/event_logger.h" 18 #include "chrome/browser/chromeos/drive/event_logger.h"
19 #include "chrome/browser/chromeos/drive/file_write_helper.h" 19 #include "chrome/browser/chromeos/drive/file_write_helper.h"
20 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h" 20 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h"
21 #include "chrome/browser/download/download_service.h" 21 #include "chrome/browser/download/download_service.h"
22 #include "chrome/browser/download/download_service_factory.h" 22 #include "chrome/browser/download/download_service_factory.h"
23 #include "chrome/browser/download/download_util.h" 23 #include "chrome/browser/download/download_util.h"
24 #include "chrome/browser/google_apis/auth_service.h" 24 #include "chrome/browser/google_apis/auth_service.h"
25 #include "chrome/browser/google_apis/drive_api_service.h" 25 #include "chrome/browser/google_apis/drive_api_service.h"
26 #include "chrome/browser/google_apis/drive_api_util.h" 26 #include "chrome/browser/google_apis/drive_api_util.h"
27 #include "chrome/browser/google_apis/drive_uploader.h"
28 #include "chrome/browser/google_apis/gdata_wapi_service.h" 27 #include "chrome/browser/google_apis/gdata_wapi_service.h"
29 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" 28 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
30 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/profiles/profile_dependency_manager.h" 30 #include "chrome/browser/profiles/profile_dependency_manager.h"
32 #include "chrome/browser/sync/profile_sync_service.h" 31 #include "chrome/browser/sync/profile_sync_service.h"
33 #include "chrome/browser/sync/profile_sync_service_factory.h" 32 #include "chrome/browser/sync/profile_sync_service_factory.h"
34 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/chrome_version_info.h" 34 #include "chrome/common/chrome_version_info.h"
36 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
37 #include "content/public/browser/browser_context.h" 36 #include "content/public/browser/browser_context.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } else { 124 } else {
126 drive_service_.reset(new google_apis::GDataWapiService( 125 drive_service_.reset(new google_apis::GDataWapiService(
127 g_browser_process->system_request_context(), 126 g_browser_process->system_request_context(),
128 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 127 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
129 GetDriveUserAgent())); 128 GetDriveUserAgent()));
130 } 129 }
131 cache_.reset(new DriveCache(!test_cache_root.empty() ? test_cache_root : 130 cache_.reset(new DriveCache(!test_cache_root.empty() ? test_cache_root :
132 DriveCache::GetCacheRootPath(profile), 131 DriveCache::GetCacheRootPath(profile),
133 blocking_task_runner_, 132 blocking_task_runner_,
134 NULL /* free_disk_space_getter */)); 133 NULL /* free_disk_space_getter */));
135 uploader_.reset(new google_apis::DriveUploader(drive_service_.get()));
136 webapps_registry_.reset(new DriveWebAppsRegistry); 134 webapps_registry_.reset(new DriveWebAppsRegistry);
137 135
138 // We can call DriveCache::GetCacheDirectoryPath safely even before the cache 136 // We can call DriveCache::GetCacheDirectoryPath safely even before the cache
139 // gets initialized. 137 // gets initialized.
140 resource_metadata_.reset(new DriveResourceMetadata( 138 resource_metadata_.reset(new DriveResourceMetadata(
141 drive_service_->GetRootResourceId(), 139 drive_service_->GetRootResourceId(),
142 cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META), 140 cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META),
143 blocking_task_runner_)); 141 blocking_task_runner_));
144 142
145 file_system_.reset(test_file_system ? test_file_system : 143 file_system_.reset(test_file_system ? test_file_system :
146 new DriveFileSystem(profile_, 144 new DriveFileSystem(profile_,
147 cache(), 145 cache(),
148 drive_service_.get(), 146 drive_service_.get(),
149 uploader(),
150 webapps_registry(), 147 webapps_registry(),
151 resource_metadata_.get(), 148 resource_metadata_.get(),
152 blocking_task_runner_)); 149 blocking_task_runner_));
153 file_write_helper_.reset(new FileWriteHelper(file_system())); 150 file_write_helper_.reset(new FileWriteHelper(file_system()));
154 download_handler_.reset(new DriveDownloadHandler(file_write_helper(), 151 download_handler_.reset(new DriveDownloadHandler(file_write_helper(),
155 file_system())); 152 file_system()));
156 sync_client_.reset(new DriveSyncClient(profile_, file_system(), cache())); 153 sync_client_.reset(new DriveSyncClient(profile_, file_system(), cache()));
157 prefetcher_.reset(new DrivePrefetcher(file_system(), 154 prefetcher_.reset(new DrivePrefetcher(file_system(),
158 event_logger(), 155 event_logger(),
159 DrivePrefetcherOptions())); 156 DrivePrefetcherOptions()));
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 if (factory_for_test_.is_null()) 457 if (factory_for_test_.is_null())
461 service = new DriveSystemService(profile, NULL, base::FilePath(), NULL); 458 service = new DriveSystemService(profile, NULL, base::FilePath(), NULL);
462 else 459 else
463 service = factory_for_test_.Run(profile); 460 service = factory_for_test_.Run(profile);
464 461
465 service->Initialize(); 462 service->Initialize();
466 return service; 463 return service;
467 } 464 }
468 465
469 } // namespace drive 466 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698