OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/browser/extension_protocols.h" | 5 #include "extensions/browser/extension_protocols.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 weak_factory_(this) { | 188 weak_factory_(this) { |
189 if (follow_symlinks_anywhere) { | 189 if (follow_symlinks_anywhere) { |
190 resource_.set_follow_symlinks_anywhere(); | 190 resource_.set_follow_symlinks_anywhere(); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 void GetResponseInfo(net::HttpResponseInfo* info) override { | 194 void GetResponseInfo(net::HttpResponseInfo* info) override { |
195 *info = response_info_; | 195 *info = response_info_; |
196 } | 196 } |
197 | 197 |
| 198 // This always returns 200 because a URLRequestExtensionJob will only get |
| 199 // created in MaybeCreateJob() if the file exists. |
| 200 int GetResponseCode() const override { return 200; } |
| 201 |
198 void Start() override { | 202 void Start() override { |
199 request_timer_.reset(new base::ElapsedTimer()); | 203 request_timer_.reset(new base::ElapsedTimer()); |
200 base::FilePath* read_file_path = new base::FilePath; | 204 base::FilePath* read_file_path = new base::FilePath; |
201 base::Time* last_modified_time = new base::Time(); | 205 base::Time* last_modified_time = new base::Time(); |
202 bool posted = BrowserThread::PostBlockingPoolTaskAndReply( | 206 bool posted = BrowserThread::PostBlockingPoolTaskAndReply( |
203 FROM_HERE, | 207 FROM_HERE, |
204 base::Bind(&ReadResourceFilePathAndLastModifiedTime, | 208 base::Bind(&ReadResourceFilePathAndLastModifiedTime, |
205 resource_, | 209 resource_, |
206 directory_path_, | 210 directory_path_, |
207 base::Unretained(read_file_path), | 211 base::Unretained(read_file_path), |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return new net::HttpResponseHeaders(raw_headers); | 557 return new net::HttpResponseHeaders(raw_headers); |
554 } | 558 } |
555 | 559 |
556 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( | 560 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( |
557 bool is_incognito, | 561 bool is_incognito, |
558 extensions::InfoMap* extension_info_map) { | 562 extensions::InfoMap* extension_info_map) { |
559 return new ExtensionProtocolHandler(is_incognito, extension_info_map); | 563 return new ExtensionProtocolHandler(is_incognito, extension_info_map); |
560 } | 564 } |
561 | 565 |
562 } // namespace extensions | 566 } // namespace extensions |
OLD | NEW |