uninstall_app_task.h revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
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_UNINSTALL_APP_TASK_H_
6#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_UNINSTALL_APP_TASK_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "base/memory/weak_ptr.h"
10#include "chrome/browser/google_apis/gdata_errorcode.h"
11#include "chrome/browser/sync_file_system/remote_file_sync_service.h"
12#include "chrome/browser/sync_file_system/sync_callbacks.h"
13#include "chrome/browser/sync_file_system/sync_task.h"
14
15namespace drive {
16class DriveServiceInterface;
17}
18
19namespace google_apis {
20class ResourceEntry;
21class ResourceList;
22}
23
24namespace sync_file_system {
25namespace drive_backend {
26
27class FileTracker;
28class MetadataDatabase;
29class SyncEngineContext;
30class TrackerSet;
31
32class UninstallAppTask : public SyncTask {
33 public:
34  typedef RemoteFileSyncService::UninstallFlag UninstallFlag;
35  UninstallAppTask(SyncEngineContext* sync_context,
36                   const std::string& app_id,
37                   UninstallFlag uninstall_flag);
38  virtual ~UninstallAppTask();
39
40  virtual void Run(const SyncStatusCallback& callback) OVERRIDE;
41
42 private:
43  void DidDeleteAppRoot(const SyncStatusCallback& callback,
44                        int64 change_id,
45                        google_apis::GDataErrorCode error);
46
47  MetadataDatabase* metadata_database();
48  drive::DriveServiceInterface* drive_service();
49
50  SyncEngineContext* sync_context_;  // Not owned.
51
52  std::string app_id_;
53  UninstallFlag uninstall_flag_;
54  int64 app_root_tracker_id_;
55
56  base::WeakPtrFactory<UninstallAppTask> weak_ptr_factory_;
57
58  DISALLOW_COPY_AND_ASSIGN(UninstallAppTask);
59};
60
61}  // namespace drive_backend
62}  // namespace sync_file_system
63
64#endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_UNINSTALL_APP_TASK_H_
65