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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_system_service.cc

Issue 10535026: Move creation and ownership of DownloadManager from the embedder to content. This matches all the o… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros compile Created 8 years, 6 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/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/download/download_service.h" 10 #include "chrome/browser/download/download_service.h"
11 #include "chrome/browser/download/download_service_factory.h" 11 #include "chrome/browser/download/download_service_factory.h"
12 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 12 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
13 #include "chrome/browser/chromeos/gdata/gdata_documents_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_sync_client.h" 16 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h"
17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" 17 #include "chrome/browser/chromeos/gdata/gdata_uploader.h"
18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_dependency_manager.h" 19 #include "chrome/browser/profiles/profile_dependency_manager.h"
20 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
20 22
23 using content::BrowserContext;
21 using content::BrowserThread; 24 using content::BrowserThread;
22 25
23 namespace gdata { 26 namespace gdata {
24 27
25 //===================== GDataSystemService ==================================== 28 //===================== GDataSystemService ====================================
26 GDataSystemService::GDataSystemService(Profile* profile) 29 GDataSystemService::GDataSystemService(Profile* profile)
27 : profile_(profile), 30 : profile_(profile),
28 documents_service_(new DocumentsService), 31 documents_service_(new DocumentsService),
29 file_system_(new GDataFileSystem(profile, docs_service())), 32 file_system_(new GDataFileSystem(profile, docs_service())),
30 uploader_(new GDataUploader(file_system(), docs_service())), 33 uploader_(new GDataUploader(file_system(), docs_service())),
(...skipping 10 matching lines...) Expand all
41 void GDataSystemService::Initialize() { 44 void GDataSystemService::Initialize() {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
43 46
44 // This order is necessary so the sync_client_ doesn't miss 47 // This order is necessary so the sync_client_ doesn't miss
45 // OnCacheInitialized() notification. 48 // OnCacheInitialized() notification.
46 sync_client_->Initialize(); 49 sync_client_->Initialize();
47 file_system_->Initialize(); 50 file_system_->Initialize();
48 51
49 content::DownloadManager* download_manager = 52 content::DownloadManager* download_manager =
50 g_browser_process->download_status_updater() ? 53 g_browser_process->download_status_updater() ?
51 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager() : 54 BrowserContext::GetDownloadManager(profile_) : NULL;
52 NULL;
53 download_observer_->Initialize( 55 download_observer_->Initialize(
54 uploader_.get(), 56 uploader_.get(),
55 download_manager, 57 download_manager,
56 file_system_->GetCacheDirectoryPath( 58 file_system_->GetCacheDirectoryPath(
57 GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); 59 GDataCache::CACHE_TYPE_TMP_DOWNLOADS));
58 } 60 }
59 61
60 void GDataSystemService::Shutdown() { 62 void GDataSystemService::Shutdown() {
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
62 64
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 102 }
101 103
102 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor( 104 ProfileKeyedService* GDataSystemServiceFactory::BuildServiceInstanceFor(
103 Profile* profile) const { 105 Profile* profile) const {
104 GDataSystemService* service = new GDataSystemService(profile); 106 GDataSystemService* service = new GDataSystemService(profile);
105 service->Initialize(); 107 service->Initialize();
106 return service; 108 return service;
107 } 109 }
108 110
109 } // namespace gdata 111 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698