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

Side by Side Diff: chrome/browser/renderer_host/redirect_to_file_resource_handler.h

Issue 3165062: Deletable file references. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/platform_file.h" 9 #include "base/platform_file.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "base/scoped_callback_factory.h" 11 #include "base/scoped_callback_factory.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/renderer_host/resource_handler.h" 13 #include "chrome/browser/renderer_host/resource_handler.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 15
16 class RefCountedPlatformFile; 16 class RefCountedPlatformFile;
17 class ResourceDispatcherHost; 17 class ResourceDispatcherHost;
18 18
19 namespace net { 19 namespace net {
20 class FileStream; 20 class FileStream;
21 class GrowableIOBuffer; 21 class GrowableIOBuffer;
22 } 22 }
23 23
24 namespace webkit_blob {
25 class DeletableFileReference;
26 }
27
24 // Redirects network data to a file. This is intended to be layered in front 28 // Redirects network data to a file. This is intended to be layered in front
25 // of either the AsyncResourceHandler or the SyncResourceHandler. 29 // of either the AsyncResourceHandler or the SyncResourceHandler.
26 class RedirectToFileResourceHandler : public ResourceHandler { 30 class RedirectToFileResourceHandler : public ResourceHandler {
27 public: 31 public:
28 RedirectToFileResourceHandler( 32 RedirectToFileResourceHandler(
29 ResourceHandler* next_handler, 33 ResourceHandler* next_handler,
30 int process_id, 34 int process_id,
31 ResourceDispatcherHost* resource_dispatcher_host); 35 ResourceDispatcherHost* resource_dispatcher_host);
32 36
33 // ResourceHandler implementation: 37 // ResourceHandler implementation:
(...skipping 30 matching lines...) Expand all
64 // network (buf_write_pending_ is true while the system is copying data into 68 // network (buf_write_pending_ is true while the system is copying data into
65 // buf_), and then write this buffer out to disk (write_callback_pending_ is 69 // buf_), and then write this buffer out to disk (write_callback_pending_ is
66 // true while writing to disk). Reading from the network is suspended while 70 // true while writing to disk). Reading from the network is suspended while
67 // the buffer is full (BufIsFull returns true). The write_cursor_ member 71 // the buffer is full (BufIsFull returns true). The write_cursor_ member
68 // tracks the offset into buf_ that we are writing to disk. 72 // tracks the offset into buf_ that we are writing to disk.
69 73
70 scoped_refptr<net::GrowableIOBuffer> buf_; 74 scoped_refptr<net::GrowableIOBuffer> buf_;
71 bool buf_write_pending_; 75 bool buf_write_pending_;
72 int write_cursor_; 76 int write_cursor_;
73 77
74 FilePath file_path_;
75 scoped_ptr<net::FileStream> file_stream_; 78 scoped_ptr<net::FileStream> file_stream_;
76 net::CompletionCallbackImpl<RedirectToFileResourceHandler> write_callback_; 79 net::CompletionCallbackImpl<RedirectToFileResourceHandler> write_callback_;
77 bool write_callback_pending_; 80 bool write_callback_pending_;
78 81
82 // We create a DeletableFileReference for the temp file created as
83 // a result of the download.
84 scoped_refptr<webkit_blob::DeletableFileReference> deletable_file_;
85
79 DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler); 86 DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler);
80 }; 87 };
81 88
82 #endif // CHROME_BROWSER_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ 89 #endif // CHROME_BROWSER_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698