When enabling new profile management programmatically, make sure to set the
[chromium-blink-merge.git] / content / browser / loader / temporary_file_stream.h
blob1cb4bc25be85a44e9012c2e43be6ca6e78caba50
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_LOADER_TEMPORARY_FILE_STREAM_H_
6 #define CONTENT_BROWSER_LOADER_TEMPORARY_FILE_STREAM_H_
8 #include "base/callback_forward.h"
9 #include "base/files/file.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h"
13 namespace net {
14 class FileStream;
17 namespace webkit_blob {
18 class ShareableFileReference;
21 namespace content {
23 typedef base::Callback<void(base::File::Error,
24 scoped_ptr<net::FileStream>,
25 webkit_blob::ShareableFileReference*)>
26 CreateTemporaryFileStreamCallback;
28 // Creates a temporary file and asynchronously calls |callback| with a
29 // net::FileStream and webkit_blob::ShareableFileReference. The file is deleted
30 // when the webkit_blob::ShareableFileReference is deleted. Note it is the
31 // consumer's responsibility to ensure the webkit_blob::ShareableFileReference
32 // stays in scope until net::FileStream has finished closing the file. On error,
33 // |callback| is called with an error in the first parameter.
35 // This function may only be called on the IO thread.
37 // TODO(davidben): Juggling the net::FileStream and
38 // webkit_blob::ShareableFileReference lifetimes is a nuisance. The two should
39 // be tied together so the consumer need not deal with it.
40 CONTENT_EXPORT void CreateTemporaryFileStream(
41 const CreateTemporaryFileStreamCallback& callback);
43 } // namespace content
45 #endif // CONTENT_BROWSER_LOADER_TEMPORARY_FILE_STREAM_H_