BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / components / drive / file_system / set_property_operation.h
blob2e04441799a2d4a991c9e0736081b6b9da97de53
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_
8 #include <string>
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"
17 namespace base {
18 class FilePath;
19 class SequencedTaskRunner;
20 } // namespace base
22 namespace drive {
23 namespace internal {
24 class ResourceMetadata;
25 } // namespace internal
27 class ResourceEntry;
29 namespace file_system {
31 class OperationDelegate;
33 class SetPropertyOperation {
34 public:
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
42 // overwritten.
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);
49 private:
50 // Part of SetProperty(). Runs after updating the local state.
51 void SetPropertyAfterUpdateLocalState(const FileOperationCallback& callback,
52 const ResourceEntry* entry,
53 FileError result);
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
68 } // namespace drive
70 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_