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

Side by Side Diff: content/browser/file_system/file_system_dispatcher_host.h

Issue 9372044: Refactor FileSystemOperation to take callback for each method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reflected kinuko's comments + Fixture for failing-Write -> Cancel pattern. Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_util_proxy.h"
11 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/platform_file.h"
12 #include "content/public/browser/browser_message_filter.h" 14 #include "content/public/browser/browser_message_filter.h"
13 #include "webkit/fileapi/file_system_types.h" 15 #include "webkit/fileapi/file_system_types.h"
14 16
15 class FilePath; 17 class FilePath;
16 class GURL; 18 class GURL;
17 19
18 namespace base { 20 namespace base {
19 class Time; 21 class Time;
20 } 22 }
21 23
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const GURL& path, 83 const GURL& path,
82 const base::Time& last_access_time, 84 const base::Time& last_access_time,
83 const base::Time& last_modified_time); 85 const base::Time& last_modified_time);
84 void OnCancel(int request_id, int request_to_cancel); 86 void OnCancel(int request_id, int request_to_cancel);
85 void OnOpenFile(int request_id, const GURL& path, int file_flags); 87 void OnOpenFile(int request_id, const GURL& path, int file_flags);
86 void OnWillUpdate(const GURL& path); 88 void OnWillUpdate(const GURL& path);
87 void OnDidUpdate(const GURL& path, int64 delta); 89 void OnDidUpdate(const GURL& path, int64 delta);
88 void OnSyncGetPlatformPath(const GURL& path, 90 void OnSyncGetPlatformPath(const GURL& path,
89 FilePath* platform_path); 91 FilePath* platform_path);
90 92
93 // Callback functions to be used when each file operation is finished.
94 void DidFinish(int request_id, base::PlatformFileError result);
95 void DidCancel(int request_id, base::PlatformFileError result);
96 void DidGetMetadata(int request_id,
97 base::PlatformFileError result,
98 const base::PlatformFileInfo& info,
99 const FilePath& platform_path);
100 void DidReadDirectory(int request_id,
101 base::PlatformFileError result,
102 const std::vector<base::FileUtilProxy::Entry>& entries,
103 bool has_more);
104 void DidOpenFile(int request_id,
105 base::PlatformFileError result,
106 base::PlatformFile file,
107 base::ProcessHandle peer_handle);
108 void DidWrite(int request_id,
109 base::PlatformFileError result,
110 int64 bytes,
111 bool complete);
112 void DidOpenFileSystem(int request_id,
113 base::PlatformFileError result,
114 const std::string& name,
115 const GURL& root);
116
91 // Creates a new FileSystemOperationInterface based on |target_path|. 117 // Creates a new FileSystemOperationInterface based on |target_path|.
92 fileapi::FileSystemOperationInterface* GetNewOperation( 118 fileapi::FileSystemOperationInterface* GetNewOperation(
93 const GURL& target_path, 119 const GURL& target_path,
94 int request_id); 120 int request_id);
95 121
96 fileapi::FileSystemContext* context_; 122 fileapi::FileSystemContext* context_;
97 123
98 // Keeps ongoing file system operations. 124 // Keeps ongoing file system operations.
99 typedef IDMap<fileapi::FileSystemOperationInterface> OperationsMap; 125 typedef IDMap<fileapi::FileSystemOperationInterface> OperationsMap;
100 OperationsMap operations_; 126 OperationsMap operations_;
101 127
102 // The getter holds the context until Init() can be called from the 128 // The getter holds the context until Init() can be called from the
103 // IO thread, which will extract the net::URLRequestContext from it. 129 // IO thread, which will extract the net::URLRequestContext from it.
104 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 130 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
105 net::URLRequestContext* request_context_; 131 net::URLRequestContext* request_context_;
106 132
107 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); 133 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost);
108 }; 134 };
109 135
110 #endif // CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ 136 #endif // CONTENT_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698