uninstall_app_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_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/sync_file_system/remote_file_sync_service.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 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  bool IsContextReady();
48  MetadataDatabase* metadata_database();
49  drive::DriveServiceInterface* drive_service();
50
51  SyncEngineContext* sync_context_;  // Not owned.
52
53  std::string app_id_;
54  UninstallFlag uninstall_flag_;
55  int64 app_root_tracker_id_;
56
57  base::WeakPtrFactory<UninstallAppTask> weak_ptr_factory_;
58
59  DISALLOW_COPY_AND_ASSIGN(UninstallAppTask);
60};
61
62}  // namespace drive_backend
63}  // namespace sync_file_system
64
65#endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_UNINSTALL_APP_TASK_H_
66