Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / file_system / remove_operation.h
bloba9b9e2d82b73d68cd33ed4ab8365c3c9131d116c
1 // Copyright (c) 2012 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_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "components/drive/file_errors.h"
14 #include "google_apis/drive/drive_api_error_codes.h"
16 namespace base {
17 class FilePath;
18 class SequencedTaskRunner;
19 } // namespace base
21 namespace drive {
23 class ResourceEntry;
25 namespace internal {
26 class FileCache;
27 class ResourceMetadata;
28 } // namespace internal
30 namespace file_system {
32 class OperationDelegate;
34 // This class encapsulates the drive Remove function. It is responsible for
35 // moving the removed entry to the trash.
36 class RemoveOperation {
37 public:
38 RemoveOperation(base::SequencedTaskRunner* blocking_task_runner,
39 OperationDelegate* delegate,
40 internal::ResourceMetadata* metadata,
41 internal::FileCache* cache);
42 ~RemoveOperation();
44 // Removes the resource at |path|. If |path| is a directory and |is_recursive|
45 // is set, it recursively removes all the descendants. If |is_recursive| is
46 // not set, it succeeds only when the directory is empty.
48 // |callback| must not be null.
49 void Remove(const base::FilePath& path,
50 bool is_recursive,
51 const FileOperationCallback& callback);
53 private:
54 // Part of Remove(). Called after UpdateLocalState() completion.
55 void RemoveAfterUpdateLocalState(const FileOperationCallback& callback,
56 const std::string* local_id,
57 const ResourceEntry* entry,
58 const base::FilePath* changed_directory_path,
59 FileError error);
61 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
62 OperationDelegate* delegate_;
63 internal::ResourceMetadata* metadata_;
64 internal::FileCache* cache_;
66 base::ThreadChecker thread_checker_;
68 // Note: This should remain the last member so it'll be destroyed and
69 // invalidate the weak pointers before any other members are destroyed.
70 base::WeakPtrFactory<RemoveOperation> weak_ptr_factory_;
71 DISALLOW_COPY_AND_ASSIGN(RemoveOperation);
74 } // namespace file_system
75 } // namespace drive
77 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_REMOVE_OPERATION_H_