Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h

Issue 663713002: [fsp] Extract ObservedEntry and ObservedEntries to a separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Added missing files. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF ACE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF ACE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF ACE_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERF ACE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file.h" 13 #include "base/files/file.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "chrome/browser/chromeos/file_system_provider/observed_entry.h"
fukino 2014/10/17 04:51:02 nit: unneeded header?
mtomasz 2014/10/17 05:29:43 ObservedEntry was previously declared in the same
18 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse rver.h" 19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse rver.h"
19 #include "storage/browser/fileapi/async_file_util.h" 20 #include "storage/browser/fileapi/async_file_util.h"
20 21
21 class EventRouter; 22 class EventRouter;
22 23
23 namespace base { 24 namespace base {
24 class Time; 25 class Time;
25 } // namespace base 26 } // namespace base
26 27
27 namespace net { 28 namespace net {
(...skipping 22 matching lines...) Expand all
50 DISALLOW_COPY_AND_ASSIGN(EntryMetadata); 51 DISALLOW_COPY_AND_ASSIGN(EntryMetadata);
51 }; 52 };
52 53
53 // Interface for a provided file system. Acts as a proxy between providers 54 // Interface for a provided file system. Acts as a proxy between providers
54 // and clients. All of the request methods return an abort callback in order to 55 // and clients. All of the request methods return an abort callback in order to
55 // terminate it while running. They must be called on the same thread as the 56 // terminate it while running. They must be called on the same thread as the
56 // request methods. The cancellation callback may be null if the operation 57 // request methods. The cancellation callback may be null if the operation
57 // fails synchronously. 58 // fails synchronously.
58 class ProvidedFileSystemInterface { 59 class ProvidedFileSystemInterface {
59 public: 60 public:
60 struct ObservedEntry;
61 struct ChildChange; 61 struct ChildChange;
62 62
63 // Mode of opening a file. Used by OpenFile(). 63 // Mode of opening a file. Used by OpenFile().
64 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; 64 enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE };
65 65
66 // Extra fields to be fetched with metadata. 66 // Extra fields to be fetched with metadata.
67 enum MetadataField { 67 enum MetadataField {
68 METADATA_FIELD_DEFAULT = 0, 68 METADATA_FIELD_DEFAULT = 0,
69 METADATA_FIELD_THUMBNAIL = 1 << 0 69 METADATA_FIELD_THUMBNAIL = 1 << 0
70 }; 70 };
71 71
72 typedef base::Callback<void(int file_handle, base::File::Error result)> 72 typedef base::Callback<void(int file_handle, base::File::Error result)>
73 OpenFileCallback; 73 OpenFileCallback;
74 74
75 typedef base::Callback< 75 typedef base::Callback<
76 void(int chunk_length, bool has_more, base::File::Error result)> 76 void(int chunk_length, bool has_more, base::File::Error result)>
77 ReadChunkReceivedCallback; 77 ReadChunkReceivedCallback;
78 78
79 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata, 79 typedef base::Callback<void(scoped_ptr<EntryMetadata> entry_metadata,
80 base::File::Error result)> GetMetadataCallback; 80 base::File::Error result)> GetMetadataCallback;
81 81
82 typedef base::Callback<void( 82 typedef base::Callback<void(
83 const storage::AsyncFileUtil::StatusCallback& callback)> AbortCallback; 83 const storage::AsyncFileUtil::StatusCallback& callback)> AbortCallback;
84 84
85 // Mask of fields requested from the GetMetadata() call. 85 // Mask of fields requested from the GetMetadata() call.
86 typedef int MetadataFieldMask; 86 typedef int MetadataFieldMask;
87 87
88 // List of observed entries.
89 typedef std::map<base::FilePath, ObservedEntry> ObservedEntries;
90
91 // Represents an observed entry on the file system.
92 struct ObservedEntry {
93 ObservedEntry();
94 ~ObservedEntry();
95
96 base::FilePath entry_path;
97 bool recursive;
98 std::string last_tag;
99 };
100
101 virtual ~ProvidedFileSystemInterface() {} 88 virtual ~ProvidedFileSystemInterface() {}
102 89
103 // Requests unmounting of the file system. The callback is called when the 90 // Requests unmounting of the file system. The callback is called when the
104 // request is accepted or rejected, with an error code. 91 // request is accepted or rejected, with an error code.
105 virtual AbortCallback RequestUnmount( 92 virtual AbortCallback RequestUnmount(
106 const storage::AsyncFileUtil::StatusCallback& callback) = 0; 93 const storage::AsyncFileUtil::StatusCallback& callback) = 0;
107 94
108 // Requests metadata of the passed |entry_path|. It can be either a file 95 // Requests metadata of the passed |entry_path|. It can be either a file
109 // or a directory. All |fields| will be returned if supported. Note, that 96 // or a directory. All |fields| will be returned if supported. Note, that
110 // default fields are always returned. 97 // default fields are always returned.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; 213 virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0;
227 214
228 // Returns a weak pointer to this object. 215 // Returns a weak pointer to this object.
229 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; 216 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0;
230 }; 217 };
231 218
232 } // namespace file_system_provider 219 } // namespace file_system_provider
233 } // namespace chromeos 220 } // namespace chromeos
234 221
235 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_ 222 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INT ERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698