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

Side by Side Diff: content/browser/loader/async_resource_handler.h

Issue 2526983002: Refactor ResourceHandler API. (Closed)
Patch Set: Fix stuff Created 4 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ 6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "content/browser/loader/resource_handler.h" 15 #include "content/browser/loader/resource_handler.h"
16 #include "content/browser/loader/resource_message_delegate.h" 16 #include "content/browser/loader/resource_message_delegate.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace net { 21 namespace net {
22 class URLRequest; 22 class URLRequest;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 class ResourceBuffer; 26 class ResourceBuffer;
27 class ResourceController;
27 class ResourceDispatcherHostImpl; 28 class ResourceDispatcherHostImpl;
28 29
29 // Used to complete an asynchronous resource request in response to resource 30 // Used to complete an asynchronous resource request in response to resource
30 // load events from the resource dispatcher host. 31 // load events from the resource dispatcher host.
31 class CONTENT_EXPORT AsyncResourceHandler : public ResourceHandler, 32 class CONTENT_EXPORT AsyncResourceHandler : public ResourceHandler,
32 public ResourceMessageDelegate { 33 public ResourceMessageDelegate {
33 public: 34 public:
34 AsyncResourceHandler(net::URLRequest* request, 35 AsyncResourceHandler(net::URLRequest* request,
35 ResourceDispatcherHostImpl* rdh); 36 ResourceDispatcherHostImpl* rdh);
36 ~AsyncResourceHandler() override; 37 ~AsyncResourceHandler() override;
37 38
38 bool OnMessageReceived(const IPC::Message& message) override; 39 bool OnMessageReceived(const IPC::Message& message) override;
39 40
40 // ResourceHandler implementation: 41 // ResourceHandler implementation:
41 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, 42 void OnRequestRedirected(
42 ResourceResponse* response, 43 const net::RedirectInfo& redirect_info,
43 bool* defer) override; 44 ResourceResponse* response,
44 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; 45 std::unique_ptr<ResourceController> controller) override;
45 bool OnWillStart(const GURL& url, bool* defer) override; 46 void OnResponseStarted(
47 ResourceResponse* response,
48 std::unique_ptr<ResourceController> controller) override;
49 void OnWillStart(const GURL& url,
50 std::unique_ptr<ResourceController> controller) override;
46 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, 51 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
47 int* buf_size, 52 int* buf_size,
48 int min_size) override; 53 int min_size) override;
49 bool OnReadCompleted(int bytes_read, bool* defer) override; 54 void OnReadCompleted(int bytes_read,
50 void OnResponseCompleted(const net::URLRequestStatus& status, 55 std::unique_ptr<ResourceController> controller) override;
51 bool* defer) override; 56 void OnResponseCompleted(
57 const net::URLRequestStatus& status,
58 std::unique_ptr<ResourceController> controller) override;
52 void OnDataDownloaded(int bytes_downloaded) override; 59 void OnDataDownloaded(int bytes_downloaded) override;
53 60
54 private: 61 private:
55 class InliningHelper; 62 class InliningHelper;
56 63
57 // IPC message handlers: 64 // IPC message handlers:
58 void OnFollowRedirect(int request_id); 65 void OnFollowRedirect(int request_id);
59 void OnDataReceivedACK(int request_id); 66 void OnDataReceivedACK(int request_id);
60 void OnUploadProgressACK(int request_id); 67 void OnUploadProgressACK(int request_id);
61 68
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 103
97 int64_t reported_transfer_size_; 104 int64_t reported_transfer_size_;
98 int64_t reported_encoded_body_length_; 105 int64_t reported_encoded_body_length_;
99 106
100 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); 107 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler);
101 }; 108 };
102 109
103 } // namespace content 110 } // namespace content
104 111
105 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ 112 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698