OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class FileWriterBaseCallback; | 51 class FileWriterBaseCallback; |
52 class MetadataCallback; | 52 class MetadataCallback; |
53 class ExecutionContext; | 53 class ExecutionContext; |
54 class VoidCallback; | 54 class VoidCallback; |
55 | 55 |
56 class FileSystemCallbacksBase : public AsyncFileSystemCallbacks { | 56 class FileSystemCallbacksBase : public AsyncFileSystemCallbacks { |
57 public: | 57 public: |
58 virtual ~FileSystemCallbacksBase(); | 58 virtual ~FileSystemCallbacksBase(); |
59 | 59 |
60 // For ErrorCallback. | 60 // For ErrorCallback. |
61 virtual void didFail(int code) OVERRIDE; | 61 virtual void didFail(int code) OVERRIDE FINAL; |
62 | 62 |
63 // Other callback methods are implemented by each subclass. | 63 // Other callback methods are implemented by each subclass. |
64 | 64 |
65 protected: | 65 protected: |
66 FileSystemCallbacksBase(PassOwnPtr<ErrorCallback>, DOMFileSystemBase*); | 66 FileSystemCallbacksBase(PassOwnPtr<ErrorCallback>, DOMFileSystemBase*); |
67 OwnPtr<ErrorCallback> m_errorCallback; | 67 OwnPtr<ErrorCallback> m_errorCallback; |
68 DOMFileSystemBase* m_fileSystem; | 68 DOMFileSystemBase* m_fileSystem; |
69 }; | 69 }; |
70 | 70 |
71 // Subclasses ---------------------------------------------------------------- | 71 // Subclasses ---------------------------------------------------------------- |
72 | 72 |
73 class EntryCallbacks : public FileSystemCallbacksBase { | 73 class EntryCallbacks FINAL : public FileSystemCallbacksBase { |
74 public: | 74 public: |
75 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<EntryCallback>
, PassOwnPtr<ErrorCallback>, PassRefPtr<DOMFileSystemBase>, const String& expect
edPath, bool isDirectory); | 75 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<EntryCallback>
, PassOwnPtr<ErrorCallback>, PassRefPtr<DOMFileSystemBase>, const String& expect
edPath, bool isDirectory); |
76 virtual void didSucceed(); | 76 virtual void didSucceed() OVERRIDE; |
77 | 77 |
78 private: | 78 private: |
79 EntryCallbacks(PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, PassRef
Ptr<DOMFileSystemBase>, const String& expectedPath, bool isDirectory); | 79 EntryCallbacks(PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, PassRef
Ptr<DOMFileSystemBase>, const String& expectedPath, bool isDirectory); |
80 OwnPtr<EntryCallback> m_successCallback; | 80 OwnPtr<EntryCallback> m_successCallback; |
81 String m_expectedPath; | 81 String m_expectedPath; |
82 bool m_isDirectory; | 82 bool m_isDirectory; |
83 }; | 83 }; |
84 | 84 |
85 class EntriesCallbacks : public FileSystemCallbacksBase { | 85 class EntriesCallbacks FINAL : public FileSystemCallbacksBase { |
86 public: | 86 public: |
87 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<EntriesCallbac
k>, PassOwnPtr<ErrorCallback>, PassRefPtr<DirectoryReaderBase>, const String& ba
sePath); | 87 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<EntriesCallbac
k>, PassOwnPtr<ErrorCallback>, PassRefPtr<DirectoryReaderBase>, const String& ba
sePath); |
88 virtual void didReadDirectoryEntry(const String& name, bool isDirectory); | 88 virtual void didReadDirectoryEntry(const String& name, bool isDirectory) OVE
RRIDE; |
89 virtual void didReadDirectoryEntries(bool hasMore); | 89 virtual void didReadDirectoryEntries(bool hasMore) OVERRIDE; |
90 | 90 |
91 private: | 91 private: |
92 EntriesCallbacks(PassOwnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, Pas
sRefPtr<DirectoryReaderBase>, const String& basePath); | 92 EntriesCallbacks(PassOwnPtr<EntriesCallback>, PassOwnPtr<ErrorCallback>, Pas
sRefPtr<DirectoryReaderBase>, const String& basePath); |
93 OwnPtr<EntriesCallback> m_successCallback; | 93 OwnPtr<EntriesCallback> m_successCallback; |
94 RefPtr<DirectoryReaderBase> m_directoryReader; | 94 RefPtr<DirectoryReaderBase> m_directoryReader; |
95 String m_basePath; | 95 String m_basePath; |
96 EntryVector m_entries; | 96 EntryVector m_entries; |
97 }; | 97 }; |
98 | 98 |
99 class FileSystemCallbacks : public FileSystemCallbacksBase { | 99 class FileSystemCallbacks FINAL : public FileSystemCallbacksBase { |
100 public: | 100 public: |
101 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<FileSystemCall
back>, PassOwnPtr<ErrorCallback>, ExecutionContext*, FileSystemType); | 101 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<FileSystemCall
back>, PassOwnPtr<ErrorCallback>, ExecutionContext*, FileSystemType); |
102 virtual void didOpenFileSystem(const String& name, const KURL& rootURL); | 102 virtual void didOpenFileSystem(const String& name, const KURL& rootURL) OVER
RIDE; |
103 | 103 |
104 private: | 104 private: |
105 FileSystemCallbacks(PassOwnPtr<FileSystemCallback>, PassOwnPtr<ErrorCallback
>, ExecutionContext*, FileSystemType); | 105 FileSystemCallbacks(PassOwnPtr<FileSystemCallback>, PassOwnPtr<ErrorCallback
>, ExecutionContext*, FileSystemType); |
106 OwnPtr<FileSystemCallback> m_successCallback; | 106 OwnPtr<FileSystemCallback> m_successCallback; |
107 RefPtr<ExecutionContext> m_executionContext; | 107 RefPtr<ExecutionContext> m_executionContext; |
108 FileSystemType m_type; | 108 FileSystemType m_type; |
109 }; | 109 }; |
110 | 110 |
111 class ResolveURICallbacks : public FileSystemCallbacksBase { | 111 class ResolveURICallbacks FINAL : public FileSystemCallbacksBase { |
112 public: | 112 public: |
113 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<EntryCallback>
, PassOwnPtr<ErrorCallback>, ExecutionContext*); | 113 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<EntryCallback>
, PassOwnPtr<ErrorCallback>, ExecutionContext*); |
114 virtual void didResolveURL(const String& name, const KURL& rootURL, FileSyst
emType, const String& filePath, bool isDirectry); | 114 virtual void didResolveURL(const String& name, const KURL& rootURL, FileSyst
emType, const String& filePath, bool isDirectry) OVERRIDE; |
115 | 115 |
116 private: | 116 private: |
117 ResolveURICallbacks(PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, Ex
ecutionContext*); | 117 ResolveURICallbacks(PassOwnPtr<EntryCallback>, PassOwnPtr<ErrorCallback>, Ex
ecutionContext*); |
118 OwnPtr<EntryCallback> m_successCallback; | 118 OwnPtr<EntryCallback> m_successCallback; |
119 RefPtr<ExecutionContext> m_executionContext; | 119 RefPtr<ExecutionContext> m_executionContext; |
120 }; | 120 }; |
121 | 121 |
122 class MetadataCallbacks : public FileSystemCallbacksBase { | 122 class MetadataCallbacks FINAL : public FileSystemCallbacksBase { |
123 public: | 123 public: |
124 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<MetadataCallba
ck>, PassOwnPtr<ErrorCallback>, DOMFileSystemBase*); | 124 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<MetadataCallba
ck>, PassOwnPtr<ErrorCallback>, DOMFileSystemBase*); |
125 virtual void didReadMetadata(const FileMetadata&); | 125 virtual void didReadMetadata(const FileMetadata&) OVERRIDE; |
126 | 126 |
127 private: | 127 private: |
128 MetadataCallbacks(PassOwnPtr<MetadataCallback>, PassOwnPtr<ErrorCallback>, D
OMFileSystemBase*); | 128 MetadataCallbacks(PassOwnPtr<MetadataCallback>, PassOwnPtr<ErrorCallback>, D
OMFileSystemBase*); |
129 OwnPtr<MetadataCallback> m_successCallback; | 129 OwnPtr<MetadataCallback> m_successCallback; |
130 }; | 130 }; |
131 | 131 |
132 class FileWriterBaseCallbacks : public FileSystemCallbacksBase { | 132 class FileWriterBaseCallbacks FINAL : public FileSystemCallbacksBase { |
133 public: | 133 public: |
134 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassRefPtr<FileWriterBase
>, PassOwnPtr<FileWriterBaseCallback>, PassOwnPtr<ErrorCallback>); | 134 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassRefPtr<FileWriterBase
>, PassOwnPtr<FileWriterBaseCallback>, PassOwnPtr<ErrorCallback>); |
135 virtual void didCreateFileWriter(PassOwnPtr<blink::WebFileWriter>, long long
length); | 135 virtual void didCreateFileWriter(PassOwnPtr<blink::WebFileWriter>, long long
length) OVERRIDE; |
136 | 136 |
137 private: | 137 private: |
138 FileWriterBaseCallbacks(PassRefPtr<FileWriterBase>, PassOwnPtr<FileWriterBas
eCallback>, PassOwnPtr<ErrorCallback>); | 138 FileWriterBaseCallbacks(PassRefPtr<FileWriterBase>, PassOwnPtr<FileWriterBas
eCallback>, PassOwnPtr<ErrorCallback>); |
139 RefPtr<FileWriterBase> m_fileWriter; | 139 RefPtr<FileWriterBase> m_fileWriter; |
140 OwnPtr<FileWriterBaseCallback> m_successCallback; | 140 OwnPtr<FileWriterBaseCallback> m_successCallback; |
141 }; | 141 }; |
142 | 142 |
143 class VoidCallbacks : public FileSystemCallbacksBase { | 143 class VoidCallbacks FINAL : public FileSystemCallbacksBase { |
144 public: | 144 public: |
145 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<VoidCallback>,
PassOwnPtr<ErrorCallback>, DOMFileSystemBase*); | 145 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassOwnPtr<VoidCallback>,
PassOwnPtr<ErrorCallback>, DOMFileSystemBase*); |
146 virtual void didSucceed(); | 146 virtual void didSucceed() OVERRIDE; |
147 | 147 |
148 private: | 148 private: |
149 VoidCallbacks(PassOwnPtr<VoidCallback>, PassOwnPtr<ErrorCallback>, DOMFileSy
stemBase*); | 149 VoidCallbacks(PassOwnPtr<VoidCallback>, PassOwnPtr<ErrorCallback>, DOMFileSy
stemBase*); |
150 OwnPtr<VoidCallback> m_successCallback; | 150 OwnPtr<VoidCallback> m_successCallback; |
151 }; | 151 }; |
152 | 152 |
153 } // namespace | 153 } // namespace |
154 | 154 |
155 #endif // FileSystemCallbacks_h | 155 #endif // FileSystemCallbacks_h |
OLD | NEW |