Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / chromeos / drive / file_system / set_property_operation.h
blob5d5634fe045cc333583673377c536bdeaf7a8e33
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_
8 #include <string>
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"
16 namespace base {
17 class FilePath;
18 class SequencedTaskRunner;
19 } // namespace base
21 namespace drive {
22 namespace internal {
23 class ResourceMetadata;
24 } // namespace internal
26 class ResourceEntry;
28 namespace file_system {
30 class OperationDelegate;
32 class SetPropertyOperation {
33 public:
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
41 // overwritten.
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);
48 private:
49 // Part of SetProperty(). Runs after updating the local state.
50 void SetPropertyAfterUpdateLocalState(const FileOperationCallback& callback,
51 const ResourceEntry* entry,
52 FileError result);
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
65 } // namespace drive
67 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_SET_PROPERTY_OPERATION_H_