1 // Copyright 2015 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 COMPONENTS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_
6 #define COMPONENTS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/thread_checker.h"
14 #include "components/drive/file_errors.h"
15 #include "google_apis/drive/drive_api_requests.h"
19 class SequencedTaskRunner
;
24 class ResourceMetadata
;
25 } // namespace internal
29 namespace file_system
{
31 class OperationDelegate
;
33 class SetPropertyOperation
{
35 SetPropertyOperation(base::SequencedTaskRunner
* blocking_task_runner
,
36 OperationDelegate
* delegate
,
37 internal::ResourceMetadata
* metadata
);
38 ~SetPropertyOperation();
40 // Sets the |key| property on the entry at |drive_file_path| with the
41 // specified |visibility|. If the property already exists, it will be
43 void SetProperty(const base::FilePath
& drive_file_path
,
44 google_apis::drive::Property::Visibility visibility
,
45 const std::string
& key
,
46 const std::string
& value
,
47 const FileOperationCallback
& callback
);
50 // Part of SetProperty(). Runs after updating the local state.
51 void SetPropertyAfterUpdateLocalState(const FileOperationCallback
& callback
,
52 const ResourceEntry
* entry
,
55 scoped_refptr
<base::SequencedTaskRunner
> blocking_task_runner_
;
56 OperationDelegate
* delegate_
;
57 internal::ResourceMetadata
* metadata_
;
59 base::ThreadChecker thread_checker_
;
61 // Note: This should remain the last member so it'll be destroyed and
62 // invalidate the weak pointers before any other members are destroyed.
63 base::WeakPtrFactory
<SetPropertyOperation
> weak_ptr_factory_
;
64 DISALLOW_COPY_AND_ASSIGN(SetPropertyOperation
);
67 } // namespace file_system
70 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_