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

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

Issue 2323623002: Do not sniff mime type for fetch() requests (Closed)
Patch Set: fix Created 4 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
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_MIME_SNIFFING_RESOURCE_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_MIME_SNIFFING_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_MIME_SNIFFING_RESOURCE_HANDLER_H_ 6 #define CONTENT_BROWSER_LOADER_MIME_SNIFFING_RESOURCE_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "content/browser/loader/layered_resource_handler.h" 13 #include "content/browser/loader/layered_resource_handler.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/resource_controller.h" 15 #include "content/public/browser/resource_controller.h"
16 #include "content/public/common/request_context_type.h"
16 17
17 namespace net { 18 namespace net {
18 class URLRequest; 19 class URLRequest;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 class InterceptingResourceHandler; 23 class InterceptingResourceHandler;
23 class PluginService; 24 class PluginService;
24 class ResourceDispatcherHostImpl; 25 class ResourceDispatcherHostImpl;
25 struct WebPluginInfo; 26 struct WebPluginInfo;
(...skipping 11 matching lines...) Expand all
37 // Accept header on the request based on its ResourceType, if one isn't already 38 // Accept header on the request based on its ResourceType, if one isn't already
38 // present. 39 // present.
39 class CONTENT_EXPORT MimeSniffingResourceHandler 40 class CONTENT_EXPORT MimeSniffingResourceHandler
40 : public LayeredResourceHandler, 41 : public LayeredResourceHandler,
41 public ResourceController { 42 public ResourceController {
42 public: 43 public:
43 MimeSniffingResourceHandler(std::unique_ptr<ResourceHandler> next_handler, 44 MimeSniffingResourceHandler(std::unique_ptr<ResourceHandler> next_handler,
44 ResourceDispatcherHostImpl* host, 45 ResourceDispatcherHostImpl* host,
45 PluginService* plugin_service, 46 PluginService* plugin_service,
46 InterceptingResourceHandler* intercepting_handler, 47 InterceptingResourceHandler* intercepting_handler,
47 net::URLRequest* request); 48 net::URLRequest* request,
49 RequestContextType request_context_type);
48 ~MimeSniffingResourceHandler() override; 50 ~MimeSniffingResourceHandler() override;
49 51
50 private: 52 private:
51 friend class MimeSniffingResourceHandlerTest; 53 friend class MimeSniffingResourceHandlerTest;
52 enum State { 54 enum State {
53 // Starting state of the MimeSniffingResourceHandler. In this state, it is 55 // Starting state of the MimeSniffingResourceHandler. In this state, it is
54 // acting as a blind pass-through ResourceHandler until the response is 56 // acting as a blind pass-through ResourceHandler until the response is
55 // received. 57 // received.
56 STATE_STARTING, 58 STATE_STARTING,
57 59
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Used to buffer the reponse received until replay. 160 // Used to buffer the reponse received until replay.
159 scoped_refptr<ResourceResponse> response_; 161 scoped_refptr<ResourceResponse> response_;
160 scoped_refptr<net::IOBuffer> read_buffer_; 162 scoped_refptr<net::IOBuffer> read_buffer_;
161 int read_buffer_size_; 163 int read_buffer_size_;
162 int bytes_read_; 164 int bytes_read_;
163 165
164 // The InterceptingResourceHandler that will perform ResourceHandler swap if 166 // The InterceptingResourceHandler that will perform ResourceHandler swap if
165 // needed. 167 // needed.
166 InterceptingResourceHandler* intercepting_handler_; 168 InterceptingResourceHandler* intercepting_handler_;
167 169
170 RequestContextType request_context_type_;
171
168 base::WeakPtrFactory<MimeSniffingResourceHandler> weak_ptr_factory_; 172 base::WeakPtrFactory<MimeSniffingResourceHandler> weak_ptr_factory_;
169 173
170 DISALLOW_COPY_AND_ASSIGN(MimeSniffingResourceHandler); 174 DISALLOW_COPY_AND_ASSIGN(MimeSniffingResourceHandler);
171 }; 175 };
172 176
173 } // namespace content 177 } // namespace content
174 178
175 #endif // CONTENT_BROWSER_LOADER_MIME_SNIFFING_RESOURCE_HANDLER_H_ 179 #endif // CONTENT_BROWSER_LOADER_MIME_SNIFFING_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698