list_changes_task.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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.
4
5#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_
6#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "base/memory/scoped_vector.h"
10#include "base/memory/weak_ptr.h"
11#include "chrome/browser/sync_file_system/sync_callbacks.h"
12#include "chrome/browser/sync_file_system/sync_task.h"
13#include "google_apis/drive/gdata_errorcode.h"
14
15namespace drive {
16class DriveServiceInterface;
17}
18
19namespace google_apis {
20class ChangeResource;
21class ResourceList;
22}
23
24namespace sync_file_system {
25namespace drive_backend {
26
27class MetadataDatabase;
28class SyncEngineContext;
29
30class ListChangesTask : public SyncTask {
31 public:
32  explicit ListChangesTask(SyncEngineContext* sync_context);
33  virtual ~ListChangesTask();
34
35  virtual void Run(const SyncStatusCallback& callback) OVERRIDE;
36
37 private:
38  void DidListChanges(const SyncStatusCallback& callback,
39                      google_apis::GDataErrorCode error,
40                      scoped_ptr<google_apis::ResourceList> resource_list);
41
42  bool IsContextReady();
43  MetadataDatabase* metadata_database();
44  drive::DriveServiceInterface* drive_service();
45
46  SyncEngineContext* sync_context_;
47  ScopedVector<google_apis::ChangeResource> change_list_;
48
49  base::WeakPtrFactory<ListChangesTask> weak_ptr_factory_;
50
51  DISALLOW_COPY_AND_ASSIGN(ListChangesTask);
52};
53
54}  // namespace drive_backend
55}  // namespace sync_file_system
56
57#endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_
58