Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / sync_file_system / drive_backend / sync_task.h
blobd7016845b105f0fa819c84ba94070806d2c32aa5
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 {
15 class SyncTaskToken;
17 class SyncTask {
18 public:
19 SyncTask() : used_network_(false) {}
20 virtual ~SyncTask() {}
21 virtual void RunPreflight(scoped_ptr<SyncTaskToken> token) = 0;
23 bool used_network() { return used_network_; }
25 protected:
26 void set_used_network(bool used_network) {
27 used_network_ = used_network;
30 private:
31 bool used_network_;
33 DISALLOW_COPY_AND_ASSIGN(SyncTask);
36 class ExclusiveTask : public SyncTask {
37 public:
38 ExclusiveTask();
39 ~ExclusiveTask() override;
41 void RunPreflight(scoped_ptr<SyncTaskToken> token) final;
42 virtual void RunExclusive(const SyncStatusCallback& callback) = 0;
44 private:
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_