BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / operations / get_metadata.h
blob06252d4597400cb33afd82618c156a126fb88e1b
1 // Copyright 2014 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_FILE_SYSTEM_PROVIDER_OPERATIONS_GET_METADATA_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_GET_METADATA_H_
8 #include "base/files/file.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/file_system_provider/operations/operation.h"
11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
13 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
14 #include "chrome/common/extensions/api/file_system_provider_internal.h"
16 namespace base {
17 class FilePath;
18 } // namespace base
20 namespace extensions {
21 class EventRouter;
22 } // namespace extensions
24 namespace chromeos {
25 namespace file_system_provider {
26 namespace operations {
28 // Validates the metadata. If it's incorrect (eg. incorrect characters in the
29 // name or empty for non-root), then returns false.
30 bool ValidateIDLEntryMetadata(
31 const extensions::api::file_system_provider::EntryMetadata& metadata,
32 bool root_entry);
34 // Checks whether the passed name is valid or not.
35 bool ValidateName(const std::string& name, bool root_entry);
37 // Bridge between fileapi get metadata operation and providing extension's get
38 // metadata request. Created per request.
39 class GetMetadata : public Operation {
40 public:
41 GetMetadata(extensions::EventRouter* event_router,
42 const ProvidedFileSystemInfo& file_system_info,
43 const base::FilePath& entry_path,
44 ProvidedFileSystemInterface::MetadataFieldMask fields,
45 const ProvidedFileSystemInterface::GetMetadataCallback& callback);
46 ~GetMetadata() override;
48 // Operation overrides.
49 bool Execute(int request_id) override;
50 void OnSuccess(int request_id,
51 scoped_ptr<RequestValue> result,
52 bool has_more) override;
53 void OnError(int request_id,
54 scoped_ptr<RequestValue> result,
55 base::File::Error error) override;
57 private:
58 base::FilePath entry_path_;
59 ProvidedFileSystemInterface::MetadataFieldMask fields_;
60 const ProvidedFileSystemInterface::GetMetadataCallback callback_;
62 DISALLOW_COPY_AND_ASSIGN(GetMetadata);
65 } // namespace operations
66 } // namespace file_system_provider
67 } // namespace chromeos
69 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_GET_METADATA_H_