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 CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_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 "chrome/browser/chromeos/drive/file_errors.h"
14 #include "google_apis/drive/drive_api_requests.h"
18 class SequencedTaskRunner
;
23 class ResourceMetadata
;
24 } // namespace internal
28 namespace file_system
{
30 class OperationDelegate
;
32 class SetPropertyOperation
{
34 SetPropertyOperation(base::SequencedTaskRunner
* blocking_task_runner
,
35 OperationDelegate
* delegate
,
36 internal::ResourceMetadata
* metadata
);
37 ~SetPropertyOperation();
39 // Sets the |key| property on the entry at |drive_file_path| with the
40 // specified |visibility|. If the property already exists, it will be
42 void SetProperty(const base::FilePath
& drive_file_path
,
43 google_apis::drive::Property::Visibility visibility
,
44 const std::string
& key
,
45 const std::string
& value
,
46 const FileOperationCallback
& callback
);
49 // Part of SetProperty(). Runs after updating the local state.
50 void SetPropertyAfterUpdateLocalState(const FileOperationCallback
& callback
,
51 const ResourceEntry
* entry
,
54 scoped_refptr
<base::SequencedTaskRunner
> blocking_task_runner_
;
55 OperationDelegate
* delegate_
;
56 internal::ResourceMetadata
* metadata_
;
58 // Note: This should remain the last member so it'll be destroyed and
59 // invalidate the weak pointers before any other members are destroyed.
60 base::WeakPtrFactory
<SetPropertyOperation
> weak_ptr_factory_
;
61 DISALLOW_COPY_AND_ASSIGN(SetPropertyOperation
);
64 } // namespace file_system
67 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_