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

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

Issue 23050014: Convert drive::FileWriteHelper to a single function for simplification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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_integration_service.h" 5 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/drive/debug_info_collector.h" 13 #include "chrome/browser/chromeos/drive/debug_info_collector.h"
14 #include "chrome/browser/chromeos/drive/download_handler.h" 14 #include "chrome/browser/chromeos/drive/download_handler.h"
15 #include "chrome/browser/chromeos/drive/drive_app_registry.h" 15 #include "chrome/browser/chromeos/drive/drive_app_registry.h"
16 #include "chrome/browser/chromeos/drive/file_cache.h" 16 #include "chrome/browser/chromeos/drive/file_cache.h"
17 #include "chrome/browser/chromeos/drive/file_system.h" 17 #include "chrome/browser/chromeos/drive/file_system.h"
18 #include "chrome/browser/chromeos/drive/file_system_util.h" 18 #include "chrome/browser/chromeos/drive/file_system_util.h"
19 #include "chrome/browser/chromeos/drive/file_write_helper.h"
20 #include "chrome/browser/chromeos/drive/job_scheduler.h" 19 #include "chrome/browser/chromeos/drive/job_scheduler.h"
21 #include "chrome/browser/chromeos/drive/logging.h" 20 #include "chrome/browser/chromeos/drive/logging.h"
22 #include "chrome/browser/chromeos/drive/resource_metadata.h" 21 #include "chrome/browser/chromeos/drive/resource_metadata.h"
23 #include "chrome/browser/chromeos/drive/resource_metadata_storage.h" 22 #include "chrome/browser/chromeos/drive/resource_metadata_storage.h"
24 #include "chrome/browser/chromeos/profiles/profile_util.h" 23 #include "chrome/browser/chromeos/profiles/profile_util.h"
25 #include "chrome/browser/download/download_prefs.h" 24 #include "chrome/browser/download/download_prefs.h"
26 #include "chrome/browser/download/download_service.h" 25 #include "chrome/browser/download/download_service.h"
27 #include "chrome/browser/download/download_service_factory.h" 26 #include "chrome/browser/download/download_service_factory.h"
28 #include "chrome/browser/drive/drive_api_service.h" 27 #include "chrome/browser/drive/drive_api_service.h"
29 #include "chrome/browser/drive/drive_api_util.h" 28 #include "chrome/browser/drive/drive_api_util.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 196
198 file_system_.reset( 197 file_system_.reset(
199 test_file_system ? test_file_system : new FileSystem( 198 test_file_system ? test_file_system : new FileSystem(
200 profile_->GetPrefs(), 199 profile_->GetPrefs(),
201 cache_.get(), 200 cache_.get(),
202 drive_service_.get(), 201 drive_service_.get(),
203 scheduler_.get(), 202 scheduler_.get(),
204 resource_metadata_.get(), 203 resource_metadata_.get(),
205 blocking_task_runner_.get(), 204 blocking_task_runner_.get(),
206 cache_root_directory_.Append(util::kTemporaryFileDirectory))); 205 cache_root_directory_.Append(util::kTemporaryFileDirectory)));
207 file_write_helper_.reset(new FileWriteHelper(file_system())); 206 download_handler_.reset(new DownloadHandler(file_system()));
208 download_handler_.reset(new DownloadHandler(file_write_helper(),
209 file_system()));
210 debug_info_collector_.reset( 207 debug_info_collector_.reset(
211 new DebugInfoCollector(file_system(), cache_.get())); 208 new DebugInfoCollector(file_system(), cache_.get()));
212 } 209 }
213 210
214 DriveIntegrationService::~DriveIntegrationService() { 211 DriveIntegrationService::~DriveIntegrationService() {
215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
216 } 213 }
217 214
218 void DriveIntegrationService::Initialize() { 215 void DriveIntegrationService::Initialize() {
219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 16 matching lines...) Expand all
236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
237 234
238 DriveNotificationManager* drive_notification_manager = 235 DriveNotificationManager* drive_notification_manager =
239 DriveNotificationManagerFactory::GetForProfile(profile_); 236 DriveNotificationManagerFactory::GetForProfile(profile_);
240 if (drive_notification_manager) 237 if (drive_notification_manager)
241 drive_notification_manager->RemoveObserver(this); 238 drive_notification_manager->RemoveObserver(this);
242 239
243 RemoveDriveMountPoint(); 240 RemoveDriveMountPoint();
244 debug_info_collector_.reset(); 241 debug_info_collector_.reset();
245 download_handler_.reset(); 242 download_handler_.reset();
246 file_write_helper_.reset();
247 file_system_.reset(); 243 file_system_.reset();
248 drive_app_registry_.reset(); 244 drive_app_registry_.reset();
249 scheduler_.reset(); 245 scheduler_.reset();
250 drive_service_.reset(); 246 drive_service_.reset();
251 } 247 }
252 248
253 void DriveIntegrationService::AddObserver( 249 void DriveIntegrationService::AddObserver(
254 DriveIntegrationServiceObserver* observer) { 250 DriveIntegrationServiceObserver* observer) {
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
256 observers_.AddObserver(observer); 252 observers_.AddObserver(observer);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 profile, NULL, base::FilePath(), NULL); 477 profile, NULL, base::FilePath(), NULL);
482 } else { 478 } else {
483 service = factory_for_test_.Run(profile); 479 service = factory_for_test_.Run(profile);
484 } 480 }
485 481
486 service->Initialize(); 482 service->Initialize();
487 return service; 483 return service;
488 } 484 }
489 485
490 } // namespace drive 486 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_integration_service.h ('k') | chrome/browser/chromeos/drive/file_system_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698