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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_proxy.h

Issue 10600013: Wired support for file truncating with RemoteFileSystemOperation::OpenFile() method (case when base… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" 9 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h"
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 callback) OVERRIDE; 55 callback) OVERRIDE;
56 virtual void CreateWritableSnapshotFile( 56 virtual void CreateWritableSnapshotFile(
57 const GURL& path, 57 const GURL& path,
58 const fileapi::WritableSnapshotFile& callback) OVERRIDE; 58 const fileapi::WritableSnapshotFile& callback) OVERRIDE;
59 virtual void OpenFile( 59 virtual void OpenFile(
60 const GURL& path, 60 const GURL& path,
61 int file_flags, 61 int file_flags,
62 base::ProcessHandle peer_handle, 62 base::ProcessHandle peer_handle,
63 const fileapi::FileSystemOperationInterface::OpenFileCallback& 63 const fileapi::FileSystemOperationInterface::OpenFileCallback&
64 callback) OVERRIDE; 64 callback) OVERRIDE;
65 virtual void NotifyFileClosed(
66 const GURL& path,
67 const fileapi::FileSystemOperationInterface::StatusCallback&
68 callback) OVERRIDE;
65 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. 69 // TODO(zelidrag): More methods to follow as we implement other parts of FSO.
66 70
67 protected: 71 protected:
68 virtual ~GDataFileSystemProxy(); 72 virtual ~GDataFileSystemProxy();
69 73
70 private: 74 private:
71 // Checks if a given |url| belongs to this file system. If it does, 75 // Checks if a given |url| belongs to this file system. If it does,
72 // the call will return true and fill in |file_path| with a file path of 76 // the call will return true and fill in |file_path| with a file path of
73 // a corresponding element within this file system. 77 // a corresponding element within this file system.
74 static bool ValidateUrl(const GURL& url, FilePath* file_path); 78 static bool ValidateUrl(const GURL& url, FilePath* file_path);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 base::PlatformFileError open_result, 129 base::PlatformFileError open_result,
126 const FilePath& local_cache_path); 130 const FilePath& local_cache_path);
127 131
128 // Invoked during Truncate() operation. This is called when the truncation of 132 // Invoked during Truncate() operation. This is called when the truncation of
129 // a local cache file is finished on FILE thread. 133 // a local cache file is finished on FILE thread.
130 void DidTruncate( 134 void DidTruncate(
131 const FilePath& virtual_path, 135 const FilePath& virtual_path,
132 const fileapi::FileSystemOperationInterface::StatusCallback& callback, 136 const fileapi::FileSystemOperationInterface::StatusCallback& callback,
133 base::PlatformFileError* truncate_result); 137 base::PlatformFileError* truncate_result);
134 138
139 // Invoked during OpenFile() operation when truncate or write flags are set.
140 // This is called when a local modifiable cached file is ready for such
141 // operation.
142 void OnOpenFileForWriting(
143 int file_flags,
144 base::ProcessHandle peer_handle,
145 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback,
146 base::PlatformFileError open_result,
147 const FilePath& local_cache_path);
148
149 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED
150 // flag is set. This is called when the truncation of a local cache file is
151 // finished on FILE thread.
152 void OnOpenAndTruncate(
153 base::ProcessHandle peer_handle,
154 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback,
155 base::PlatformFile* platform_file,
156 base::PlatformFileError* truncate_result);
157
135 // GDataFileSystemProxy is owned by Profile, which outlives 158 // GDataFileSystemProxy is owned by Profile, which outlives
136 // GDataFileSystemProxy, which is owned by CrosMountPointProvider (i.e. by 159 // GDataFileSystemProxy, which is owned by CrosMountPointProvider (i.e. by
137 // the time Profile is removed, the file manager is already gone). Hence 160 // the time Profile is removed, the file manager is already gone). Hence
138 // it's safe to use this as a raw pointer. 161 // it's safe to use this as a raw pointer.
139 GDataFileSystemInterface* file_system_; 162 GDataFileSystemInterface* file_system_;
140 }; 163 };
141 164
142 } // namespace chromeos 165 } // namespace chromeos
143 166
144 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ 167 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698