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

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

Issue 1839473002: Centralize the setting of Accept headers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address mmenke's comments Created 4 years, 8 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_TYPE_RESOURCE_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_ 6 #define CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 // ResourceHandler that, if necessary, buffers a response body without passing 26 // ResourceHandler that, if necessary, buffers a response body without passing
27 // it to the next ResourceHandler until it can perform mime sniffing on it. 27 // it to the next ResourceHandler until it can perform mime sniffing on it.
28 // Once a response's MIME type is known, initiates special handling of the 28 // Once a response's MIME type is known, initiates special handling of the
29 // response if needed (starts downloads, sends data to some plugin types via a 29 // response if needed (starts downloads, sends data to some plugin types via a
30 // special channel). 30 // special channel).
31 // 31 //
32 // Uses the buffer provided by the original event handler for buffering, and 32 // Uses the buffer provided by the original event handler for buffering, and
33 // continues to reuses it until it can determine the MIME type 33 // continues to reuses it until it can determine the MIME type
34 // subsequent reads until it's done buffering. As a result, the buffer 34 // subsequent reads until it's done buffering. As a result, the buffer
35 // returned by the next ResourceHandler must have a capacity of at least 35 // returned by the next ResourceHandler must have a capacity of at least
36 // net::kMaxBytesToSniff * 2. 36 // net::kMaxBytesToSniff * 2.
mmenke 2016/04/01 15:29:08 Think it's worth mentioning its new job of setting
Nate Chapin 2016/04/01 19:01:24 Done.
37 class CONTENT_EXPORT MimeTypeResourceHandler 37 class CONTENT_EXPORT MimeTypeResourceHandler
38 : public LayeredResourceHandler, 38 : public LayeredResourceHandler,
39 public ResourceController { 39 public ResourceController {
40 public: 40 public:
41 // If ENABLE_PLUGINS is defined, |plugin_service| must not be NULL. 41 // If ENABLE_PLUGINS is defined, |plugin_service| must not be NULL.
42 MimeTypeResourceHandler(scoped_ptr<ResourceHandler> next_handler, 42 MimeTypeResourceHandler(scoped_ptr<ResourceHandler> next_handler,
43 ResourceDispatcherHostImpl* host, 43 ResourceDispatcherHostImpl* host,
44 PluginService* plugin_service, 44 PluginService* plugin_service,
45 net::URLRequest* request); 45 net::URLRequest* request);
46 ~MimeTypeResourceHandler() override; 46 ~MimeTypeResourceHandler() override;
47 47
48 private: 48 private:
49 // ResourceHandler implementation: 49 // ResourceHandler implementation:
50 void SetController(ResourceController* controller) override; 50 void SetController(ResourceController* controller) override;
51 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; 51 bool OnResponseStarted(ResourceResponse* response, bool* defer) override;
52 bool OnWillStart(const GURL&, bool* defer) override;
52 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, 53 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
53 int* buf_size, 54 int* buf_size,
54 int min_size) override; 55 int min_size) override;
55 bool OnReadCompleted(int bytes_read, bool* defer) override; 56 bool OnReadCompleted(int bytes_read, bool* defer) override;
56 void OnResponseCompleted(const net::URLRequestStatus& status, 57 void OnResponseCompleted(const net::URLRequestStatus& status,
57 const std::string& security_info, 58 const std::string& security_info,
58 bool* defer) override; 59 bool* defer) override;
59 60
60 // ResourceController implementation: 61 // ResourceController implementation:
61 void Resume() override; 62 void Resume() override;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 bool must_download_is_set_; 125 bool must_download_is_set_;
125 126
126 base::WeakPtrFactory<MimeTypeResourceHandler> weak_ptr_factory_; 127 base::WeakPtrFactory<MimeTypeResourceHandler> weak_ptr_factory_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(MimeTypeResourceHandler); 129 DISALLOW_COPY_AND_ASSIGN(MimeTypeResourceHandler);
129 }; 130 };
130 131
131 } // namespace content 132 } // namespace content
132 133
133 #endif // CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_ 134 #endif // CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698