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

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

Issue 7980011: Convert the PluginService interface to be an async wrapper around PluginList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert to PS3 and rebase Created 9 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) 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "content/browser/renderer_host/resource_handler.h" 11 #include "content/browser/renderer_host/resource_handler.h"
12 12
13 class MessageLoop; 13 class MessageLoop;
14 class ResourceDispatcherHost; 14 class ResourceDispatcherHost;
15 15
16 namespace net { 16 namespace net {
17 class URLRequest; 17 class URLRequest;
18 } // namespace net 18 } // namespace net
19 19
20 namespace webkit {
21 struct WebPluginInfo;
22 }
23
20 // Used to buffer a request until enough data has been received. 24 // Used to buffer a request until enough data has been received.
21 class BufferedResourceHandler : public ResourceHandler { 25 class BufferedResourceHandler : public ResourceHandler {
22 public: 26 public:
23 BufferedResourceHandler(ResourceHandler* handler, 27 BufferedResourceHandler(ResourceHandler* handler,
24 ResourceDispatcherHost* host, 28 ResourceDispatcherHost* host,
25 net::URLRequest* request); 29 net::URLRequest* request);
26 30
27 // ResourceHandler implementation: 31 // ResourceHandler implementation:
28 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size); 32 virtual bool OnUploadProgress(int request_id, uint64 position, uint64 size);
29 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, 33 virtual bool OnRequestRedirected(int request_id, const GURL& new_url,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // that means that the check couldn't be fully done because the plugins aren't 66 // that means that the check couldn't be fully done because the plugins aren't
63 // loaded. The function should be called again after the plugin list is 67 // loaded. The function should be called again after the plugin list is
64 // loaded. 68 // loaded.
65 bool ShouldDownload(bool* need_plugin_list); 69 bool ShouldDownload(bool* need_plugin_list);
66 70
67 // Informs the original ResourceHandler |real_handler_| that the response will 71 // Informs the original ResourceHandler |real_handler_| that the response will
68 // be handled entirely by the new ResourceHandler |handler|. 72 // be handled entirely by the new ResourceHandler |handler|.
69 // A reference to |handler| is acquired. 73 // A reference to |handler| is acquired.
70 void UseAlternateResourceHandler(int request_id, ResourceHandler* handler); 74 void UseAlternateResourceHandler(int request_id, ResourceHandler* handler);
71 75
72 // Called on the file thread to load the list of plugins.
73 void LoadPlugins();
74
75 // Called on the IO thread once the list of plugins has been loaded. 76 // Called on the IO thread once the list of plugins has been loaded.
76 void OnPluginsLoaded(); 77 void OnPluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins);
77 78
78 scoped_refptr<ResourceHandler> real_handler_; 79 scoped_refptr<ResourceHandler> real_handler_;
79 scoped_refptr<ResourceResponse> response_; 80 scoped_refptr<ResourceResponse> response_;
80 ResourceDispatcherHost* host_; 81 ResourceDispatcherHost* host_;
81 net::URLRequest* request_; 82 net::URLRequest* request_;
82 scoped_refptr<net::IOBuffer> read_buffer_; 83 scoped_refptr<net::IOBuffer> read_buffer_;
83 scoped_refptr<net::IOBuffer> my_buffer_; 84 scoped_refptr<net::IOBuffer> my_buffer_;
84 int read_buffer_size_; 85 int read_buffer_size_;
85 int bytes_read_; 86 int bytes_read_;
86 bool sniff_content_; 87 bool sniff_content_;
87 bool wait_for_plugins_; 88 bool wait_for_plugins_;
88 bool buffering_; 89 bool buffering_;
89 bool finished_; 90 bool finished_;
90 91
91 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); 92 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler);
92 }; 93 };
93 94
94 #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ 95 #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698