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

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

Issue 417983002: [fsp] Add support for truncating files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 4 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 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_FAKE_PROVIDED_FILE_SYSTEM_H _ 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _ 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H _
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const base::FilePath& file_path, 99 const base::FilePath& file_path,
100 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 100 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
101 virtual void CopyEntry( 101 virtual void CopyEntry(
102 const base::FilePath& source_path, 102 const base::FilePath& source_path,
103 const base::FilePath& target_path, 103 const base::FilePath& target_path,
104 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 104 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
105 virtual void MoveEntry( 105 virtual void MoveEntry(
106 const base::FilePath& source_path, 106 const base::FilePath& source_path,
107 const base::FilePath& target_path, 107 const base::FilePath& target_path,
108 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; 108 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
109 virtual void Truncate(
110 const base::FilePath& file_path,
111 int64 length,
112 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
109 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; 113 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE;
110 virtual RequestManager* GetRequestManager() OVERRIDE; 114 virtual RequestManager* GetRequestManager() OVERRIDE;
111 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; 115 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE;
112 116
113 // Factory callback, to be used in Service::SetFileSystemFactory(). The 117 // Factory callback, to be used in Service::SetFileSystemFactory(). The
114 // |event_router| argument can be NULL. 118 // |event_router| argument can be NULL.
115 static ProvidedFileSystemInterface* Create( 119 static ProvidedFileSystemInterface* Create(
116 Profile* profile, 120 Profile* profile,
117 const ProvidedFileSystemInfo& file_system_info); 121 const ProvidedFileSystemInfo& file_system_info);
118 122
119 private: 123 private:
120 typedef std::map<base::FilePath, FakeEntry> Entries; 124 typedef std::map<base::FilePath, FakeEntry> Entries;
121 typedef std::map<int, base::FilePath> OpenedFilesMap; 125 typedef std::map<int, base::FilePath> OpenedFilesMap;
122 126
123 ProvidedFileSystemInfo file_system_info_; 127 ProvidedFileSystemInfo file_system_info_;
124 Entries entries_; 128 Entries entries_;
125 OpenedFilesMap opened_files_; 129 OpenedFilesMap opened_files_;
126 int last_file_handle_; 130 int last_file_handle_;
127 131
128 base::WeakPtrFactory<ProvidedFileSystemInterface> weak_ptr_factory_; 132 base::WeakPtrFactory<ProvidedFileSystemInterface> weak_ptr_factory_;
129 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); 133 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem);
130 }; 134 };
131 135
132 } // namespace file_system_provider 136 } // namespace file_system_provider
133 } // namespace chromeos 137 } // namespace chromeos
134 138
135 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_ 139 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE M_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698