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

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_service_factory.cc

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/sync_file_system/sync_file_system_service_factory.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/google_apis/drive_notification_manager_factory.h" 8 #include "chrome/browser/google_apis/drive_notification_manager_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_dependency_manager.h" 10 #include "chrome/browser/profiles/profile_dependency_manager.h"
(...skipping 27 matching lines...) Expand all
38 38
39 SyncFileSystemServiceFactory::SyncFileSystemServiceFactory() 39 SyncFileSystemServiceFactory::SyncFileSystemServiceFactory()
40 : ProfileKeyedServiceFactory("SyncFileSystemService", 40 : ProfileKeyedServiceFactory("SyncFileSystemService",
41 ProfileDependencyManager::GetInstance()) { 41 ProfileDependencyManager::GetInstance()) {
42 DependsOn(google_apis::DriveNotificationManagerFactory::GetInstance()); 42 DependsOn(google_apis::DriveNotificationManagerFactory::GetInstance());
43 } 43 }
44 44
45 SyncFileSystemServiceFactory::~SyncFileSystemServiceFactory() {} 45 SyncFileSystemServiceFactory::~SyncFileSystemServiceFactory() {}
46 46
47 ProfileKeyedService* SyncFileSystemServiceFactory::BuildServiceInstanceFor( 47 ProfileKeyedService* SyncFileSystemServiceFactory::BuildServiceInstanceFor(
48 Profile* profile) const { 48 content::BrowserContext* context) const {
49 Profile* profile = static_cast<Profile*>(context);
50
49 SyncFileSystemService* service = new SyncFileSystemService(profile); 51 SyncFileSystemService* service = new SyncFileSystemService(profile);
50 52
51 scoped_ptr<LocalFileSyncService> local_file_service( 53 scoped_ptr<LocalFileSyncService> local_file_service(
52 new LocalFileSyncService(profile)); 54 new LocalFileSyncService(profile));
53 55
54 scoped_ptr<RemoteFileSyncService> remote_file_service; 56 scoped_ptr<RemoteFileSyncService> remote_file_service;
55 if (mock_remote_file_service_) { 57 if (mock_remote_file_service_) {
56 remote_file_service = mock_remote_file_service_.Pass(); 58 remote_file_service = mock_remote_file_service_.Pass();
57 } else { 59 } else {
58 // FileSystem needs to be registered before DriveFileSyncService runs 60 // FileSystem needs to be registered before DriveFileSyncService runs
59 // its initialization code. 61 // its initialization code.
60 // TODO(kinuko): Clean up RegisterSyncableFileSystem in 62 // TODO(kinuko): Clean up RegisterSyncableFileSystem in
61 // local_file_sync_context.cc, which is still there for testing. 63 // local_file_sync_context.cc, which is still there for testing.
62 RegisterSyncableFileSystem(DriveFileSyncService::kServiceName); 64 RegisterSyncableFileSystem(DriveFileSyncService::kServiceName);
63 remote_file_service.reset(new DriveFileSyncService(profile)); 65 remote_file_service.reset(new DriveFileSyncService(profile));
64 } 66 }
65 67
66 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) { 68 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) {
67 remote_file_service->SetConflictResolutionPolicy( 69 remote_file_service->SetConflictResolutionPolicy(
68 CONFLICT_RESOLUTION_MANUAL); 70 CONFLICT_RESOLUTION_MANUAL);
69 } 71 }
70 72
71 service->Initialize(local_file_service.Pass(), 73 service->Initialize(local_file_service.Pass(),
72 remote_file_service.Pass()); 74 remote_file_service.Pass());
73 return service; 75 return service;
74 } 76 }
75 77
76 } // namespace sync_file_system 78 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698