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

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

Issue 115704: Change URL back to the previous one if the typed URL causes file download.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/renderer_host/buffered_resource_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BUFFERED_RESOURCE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/renderer_host/resource_handler.h" 10 #include "chrome/browser/renderer_host/resource_handler.h"
11 11
12 class ResourceDispatcherHost; 12 class ResourceDispatcherHost;
13 class URLRequest; 13 class URLRequest;
14 14
15 // Used to buffer a request until enough data has been received. 15 // Used to buffer a request until enough data has been received.
16 class BufferedResourceHandler : public ResourceHandler { 16 class BufferedResourceHandler : public ResourceHandler {
17 public: 17 public:
18 BufferedResourceHandler(ResourceHandler* handler, 18 BufferedResourceHandler(ResourceHandler* handler,
19 ResourceDispatcherHost* host, 19 ResourceDispatcherHost* host,
20 URLRequest* request); 20 URLRequest* request,
21 int render_process_host_id,
22 int render_view_id);
21 23
22 // ResourceHandler implementation: 24 // ResourceHandler implementation:
23 bool OnUploadProgress(int request_id, uint64 position, uint64 size); 25 bool OnUploadProgress(int request_id, uint64 position, uint64 size);
24 bool OnRequestRedirected(int request_id, const GURL& new_url); 26 bool OnRequestRedirected(int request_id, const GURL& new_url);
25 bool OnResponseStarted(int request_id, ResourceResponse* response); 27 bool OnResponseStarted(int request_id, ResourceResponse* response);
26 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, 28 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
27 int min_size); 29 int min_size);
28 bool OnReadCompleted(int request_id, int* bytes_read); 30 bool OnReadCompleted(int request_id, int* bytes_read);
29 bool OnResponseCompleted(int request_id, 31 bool OnResponseCompleted(int request_id,
30 const URLRequestStatus& status, 32 const URLRequestStatus& status,
(...skipping 10 matching lines...) Expand all
41 // Returns true if there is enough information to process the DocType. 43 // Returns true if there is enough information to process the DocType.
42 bool DidBufferEnough(int bytes_read); 44 bool DidBufferEnough(int bytes_read);
43 45
44 // Returns true if we have to keep buffering data. 46 // Returns true if we have to keep buffering data.
45 bool KeepBuffering(int bytes_read); 47 bool KeepBuffering(int bytes_read);
46 48
47 // Sends a pending OnResponseStarted notification. |in_complete| is true if 49 // Sends a pending OnResponseStarted notification. |in_complete| is true if
48 // this is invoked from |OnResponseCompleted|. 50 // this is invoked from |OnResponseCompleted|.
49 bool CompleteResponseStarted(int request_id, bool in_complete); 51 bool CompleteResponseStarted(int request_id, bool in_complete);
50 52
53 // Notifies TabContents that the resource request resulted in download.
54 void NotifyDownload();
55
51 scoped_refptr<ResourceHandler> real_handler_; 56 scoped_refptr<ResourceHandler> real_handler_;
52 scoped_refptr<ResourceResponse> response_; 57 scoped_refptr<ResourceResponse> response_;
53 ResourceDispatcherHost* host_; 58 ResourceDispatcherHost* host_;
54 URLRequest* request_; 59 URLRequest* request_;
60 int render_process_host_id_;
61 int render_view_id_;
55 scoped_refptr<net::IOBuffer> read_buffer_; 62 scoped_refptr<net::IOBuffer> read_buffer_;
56 scoped_refptr<net::IOBuffer> my_buffer_; 63 scoped_refptr<net::IOBuffer> my_buffer_;
57 int read_buffer_size_; 64 int read_buffer_size_;
58 int bytes_read_; 65 int bytes_read_;
59 bool sniff_content_; 66 bool sniff_content_;
60 bool should_buffer_; 67 bool should_buffer_;
61 bool buffering_; 68 bool buffering_;
62 bool finished_; 69 bool finished_;
63 70
64 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); 71 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler);
65 }; 72 };
66 73
67 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ 74 #endif // CHROME_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/buffered_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698