1 // Copyright 2014 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_TASK_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/sync_file_system/sync_callbacks.h"
12 namespace sync_file_system
{
13 namespace drive_backend
{
19 SyncTask() : used_network_(false) {}
20 virtual ~SyncTask() {}
21 virtual void RunPreflight(scoped_ptr
<SyncTaskToken
> token
) = 0;
23 bool used_network() { return used_network_
; }
26 void set_used_network(bool used_network
) {
27 used_network_
= used_network
;
33 DISALLOW_COPY_AND_ASSIGN(SyncTask
);
36 class ExclusiveTask
: public SyncTask
{
39 ~ExclusiveTask() override
;
41 void RunPreflight(scoped_ptr
<SyncTaskToken
> token
) final
;
42 virtual void RunExclusive(const SyncStatusCallback
& callback
) = 0;
45 base::WeakPtrFactory
<ExclusiveTask
> weak_ptr_factory_
;
47 DISALLOW_COPY_AND_ASSIGN(ExclusiveTask
);
50 } // namespace drive_backend
51 } // namespace sync_file_system
53 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_H_