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

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

Issue 6532073: Move core pieces of browser\renderer_host to src\content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This is the browser side of the resource dispatcher, it receives requests
6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then
7 // fowards the messages from the URLRequests back to the correct process for
8 // handling.
9 //
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
11
12 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
13 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
14 #pragma once 7 #pragma once
15 8
16 #include <string> 9 // TODO(jam): remove this file when all files have been converted.
17 10 #include "content/browser/renderer_host/resource_handler.h"
18 #include "chrome/browser/browser_thread.h"
19
20 namespace net {
21 class IOBuffer;
22 class URLRequestStatus;
23 } // namespace net
24
25 struct ResourceResponse;
26 class GURL;
27
28 // The resource dispatcher host uses this interface to push load events to the
29 // renderer, allowing for differences in the types of IPC messages generated.
30 // See the implementations of this interface defined below.
31 class ResourceHandler
32 : public base::RefCountedThreadSafe<
33 ResourceHandler, BrowserThread::DeleteOnIOThread> {
34 public:
35 // Called as upload progress is made.
36 virtual bool OnUploadProgress(int request_id,
37 uint64 position,
38 uint64 size) = 0;
39
40 // The request was redirected to a new URL. |*defer| has an initial value of
41 // false. Set |*defer| to true to defer the redirect. The redirect may be
42 // followed later on via ResourceDispatcherHost::FollowDeferredRedirect.
43 virtual bool OnRequestRedirected(int request_id, const GURL& url,
44 ResourceResponse* response,
45 bool* defer) = 0;
46
47 // Response headers and meta data are available.
48 virtual bool OnResponseStarted(int request_id,
49 ResourceResponse* response) = 0;
50
51 // Called before the net::URLRequest for |request_id| (whose url is |url|) is
52 // to be started. If the handler returns false, then the request is cancelled.
53 // Otherwise if the return value is true, the ResourceHandler can delay the
54 // request from starting by setting |*defer = true|. A deferred request will
55 // not have called net::URLRequest::Start(), and will not resume until someone
56 // calls ResourceDispatcherHost::StartDeferredRequest().
57 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) = 0;
58
59 // Data will be read for the response. Upon success, this method places the
60 // size and address of the buffer where the data is to be written in its
61 // out-params. This call will be followed by either OnReadCompleted or
62 // OnResponseCompleted, at which point the buffer may be recycled.
63 virtual bool OnWillRead(int request_id,
64 net::IOBuffer** buf,
65 int* buf_size,
66 int min_size) = 0;
67
68 // Data (*bytes_read bytes) was written into the buffer provided by
69 // OnWillRead. A return value of false cancels the request, true continues
70 // reading data.
71 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0;
72
73 // The response is complete. The final response status is given.
74 // Returns false if the handler is deferring the call to a later time.
75 virtual bool OnResponseCompleted(int request_id,
76 const net::URLRequestStatus& status,
77 const std::string& security_info) = 0;
78
79 // Signals that the request is closed (i.e. finished successfully, cancelled).
80 // This is a signal that the associated net::URLRequest isn't valid anymore.
81 virtual void OnRequestClosed() = 0;
82
83 // This notification is synthesized by the RedirectToFileResourceHandler
84 // to indicate progress of 'download_to_file' requests. OnReadCompleted
85 // calls are consumed by the RedirectToFileResourceHandler and replaced
86 // with OnDataDownloaded calls.
87 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) {}
88
89 protected:
90 friend class BrowserThread;
91 friend class DeleteTask<ResourceHandler>;
92
93 virtual ~ResourceHandler() {}
94 };
95 11
96 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 12 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698