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

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: Rebase again 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 16 matching lines...) Expand all
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.
37 //
38 // Before a request is sent, this ResourceHandler will also set an appropriate
39 // Accept header on the request based on its ResourceType, if one isn't already
40 // present.
37 class CONTENT_EXPORT MimeTypeResourceHandler 41 class CONTENT_EXPORT MimeTypeResourceHandler
38 : public LayeredResourceHandler, 42 : public LayeredResourceHandler,
39 public ResourceController { 43 public ResourceController {
40 public: 44 public:
41 // If ENABLE_PLUGINS is defined, |plugin_service| must not be NULL. 45 // If ENABLE_PLUGINS is defined, |plugin_service| must not be NULL.
42 MimeTypeResourceHandler(scoped_ptr<ResourceHandler> next_handler, 46 MimeTypeResourceHandler(scoped_ptr<ResourceHandler> next_handler,
43 ResourceDispatcherHostImpl* host, 47 ResourceDispatcherHostImpl* host,
44 PluginService* plugin_service, 48 PluginService* plugin_service,
45 net::URLRequest* request); 49 net::URLRequest* request);
46 ~MimeTypeResourceHandler() override; 50 ~MimeTypeResourceHandler() override;
47 51
48 private: 52 private:
49 // ResourceHandler implementation: 53 // ResourceHandler implementation:
50 void SetController(ResourceController* controller) override; 54 void SetController(ResourceController* controller) override;
51 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; 55 bool OnResponseStarted(ResourceResponse* response, bool* defer) override;
56 bool OnWillStart(const GURL&, bool* defer) override;
52 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, 57 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
53 int* buf_size, 58 int* buf_size,
54 int min_size) override; 59 int min_size) override;
55 bool OnReadCompleted(int bytes_read, bool* defer) override; 60 bool OnReadCompleted(int bytes_read, bool* defer) override;
56 void OnResponseCompleted(const net::URLRequestStatus& status, 61 void OnResponseCompleted(const net::URLRequestStatus& status,
57 const std::string& security_info, 62 const std::string& security_info,
58 bool* defer) override; 63 bool* defer) override;
59 64
60 // ResourceController implementation: 65 // ResourceController implementation:
61 void Resume() override; 66 void Resume() override;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 bool must_download_is_set_; 129 bool must_download_is_set_;
125 130
126 base::WeakPtrFactory<MimeTypeResourceHandler> weak_ptr_factory_; 131 base::WeakPtrFactory<MimeTypeResourceHandler> weak_ptr_factory_;
127 132
128 DISALLOW_COPY_AND_ASSIGN(MimeTypeResourceHandler); 133 DISALLOW_COPY_AND_ASSIGN(MimeTypeResourceHandler);
129 }; 134 };
130 135
131 } // namespace content 136 } // namespace content
132 137
133 #endif // CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_ 138 #endif // CONTENT_BROWSER_LOADER_MIME_TYPE_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/browser/loader/mime_type_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698