1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_CONTEXT_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_CONTEXT_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/sequence_checker.h"
15 class SequencedTaskRunner
;
16 class SingleThreadTaskRunner
;
20 class DriveServiceInterface
;
21 class DriveUploaderInterface
;
24 namespace sync_file_system
{
26 class RemoteChangeProcessor
;
29 namespace drive_backend
{
31 class MetadataDatabase
;
33 class SyncEngineContext
{
36 scoped_ptr
<drive::DriveServiceInterface
> drive_service
,
37 scoped_ptr
<drive::DriveUploaderInterface
> drive_uploader
,
38 TaskLogger
* task_logger
,
39 const scoped_refptr
<base::SingleThreadTaskRunner
>& ui_task_runner
,
40 const scoped_refptr
<base::SequencedTaskRunner
>& worker_task_runner
,
41 const scoped_refptr
<base::SequencedWorkerPool
>& worker_pool
);
44 void SetMetadataDatabase(scoped_ptr
<MetadataDatabase
> metadata_database
);
45 void SetRemoteChangeProcessor(
46 RemoteChangeProcessor
* remote_change_processor
);
48 drive::DriveServiceInterface
* GetDriveService();
49 drive::DriveUploaderInterface
* GetDriveUploader();
50 base::WeakPtr
<TaskLogger
> GetTaskLogger();
51 MetadataDatabase
* GetMetadataDatabase();
52 RemoteChangeProcessor
* GetRemoteChangeProcessor();
53 base::SingleThreadTaskRunner
* GetUITaskRunner();
54 base::SequencedTaskRunner
* GetWorkerTaskRunner();
55 base::SequencedWorkerPool
* GetWorkerPool();
57 scoped_ptr
<MetadataDatabase
> PassMetadataDatabase();
59 void DetachFromSequence();
62 friend class DriveBackendSyncTest
;
64 scoped_ptr
<drive::DriveServiceInterface
> drive_service_
;
65 scoped_ptr
<drive::DriveUploaderInterface
> drive_uploader_
;
66 base::WeakPtr
<TaskLogger
> task_logger_
;
67 RemoteChangeProcessor
* remote_change_processor_
; // Not owned.
69 scoped_ptr
<MetadataDatabase
> metadata_database_
;
70 scoped_refptr
<base::SingleThreadTaskRunner
> ui_task_runner_
;
71 scoped_refptr
<base::SequencedTaskRunner
> worker_task_runner_
;
72 scoped_refptr
<base::SequencedWorkerPool
> worker_pool_
;
74 base::SequenceChecker sequence_checker_
;
76 DISALLOW_COPY_AND_ASSIGN(SyncEngineContext
);
79 } // namespace drive_backend
80 } // namespace sync_file_system
82 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_CONTEXT_H_