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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/base64.h" | 14 #include "base/base64.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
18 #include "base/format_macros.h" | 18 #include "base/format_macros.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/ptr_util.h" |
21 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
22 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
23 #include "base/metrics/field_trial.h" | 24 #include "base/metrics/field_trial.h" |
24 #include "base/metrics/histogram.h" | 25 #include "base/metrics/histogram.h" |
25 #include "base/metrics/sparse_histogram.h" | 26 #include "base/metrics/sparse_histogram.h" |
26 #include "base/sha1.h" | 27 #include "base/sha1.h" |
27 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
29 #include "base/strings/stringprintf.h" | 30 #include "base/strings/stringprintf.h" |
30 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 file_path_ = *read_file_path; | 276 file_path_ = *read_file_path; |
276 response_info_.headers = BuildHttpHeaders( | 277 response_info_.headers = BuildHttpHeaders( |
277 content_security_policy_, | 278 content_security_policy_, |
278 send_cors_header_, | 279 send_cors_header_, |
279 *last_modified_time); | 280 *last_modified_time); |
280 URLRequestFileJob::Start(); | 281 URLRequestFileJob::Start(); |
281 } | 282 } |
282 | 283 |
283 scoped_refptr<ContentVerifyJob> verify_job_; | 284 scoped_refptr<ContentVerifyJob> verify_job_; |
284 | 285 |
285 scoped_ptr<base::ElapsedTimer> request_timer_; | 286 std::unique_ptr<base::ElapsedTimer> request_timer_; |
286 | 287 |
287 // The position we seeked to in the file. | 288 // The position we seeked to in the file. |
288 int64_t seek_position_; | 289 int64_t seek_position_; |
289 | 290 |
290 // The number of bytes of content we read from the file. | 291 // The number of bytes of content we read from the file. |
291 int bytes_read_; | 292 int bytes_read_; |
292 | 293 |
293 net::HttpResponseInfo response_info_; | 294 net::HttpResponseInfo response_info_; |
294 base::FilePath directory_path_; | 295 base::FilePath directory_path_; |
295 extensions::ExtensionResource resource_; | 296 extensions::ExtensionResource resource_; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 raw_headers.append("\""); | 569 raw_headers.append("\""); |
569 // Also force revalidation. | 570 // Also force revalidation. |
570 raw_headers.append(1, '\0'); | 571 raw_headers.append(1, '\0'); |
571 raw_headers.append("cache-control: no-cache"); | 572 raw_headers.append("cache-control: no-cache"); |
572 } | 573 } |
573 | 574 |
574 raw_headers.append(2, '\0'); | 575 raw_headers.append(2, '\0'); |
575 return new net::HttpResponseHeaders(raw_headers); | 576 return new net::HttpResponseHeaders(raw_headers); |
576 } | 577 } |
577 | 578 |
578 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 579 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> |
579 CreateExtensionProtocolHandler(bool is_incognito, | 580 CreateExtensionProtocolHandler(bool is_incognito, |
580 extensions::InfoMap* extension_info_map) { | 581 extensions::InfoMap* extension_info_map) { |
581 return make_scoped_ptr( | 582 return base::WrapUnique( |
582 new ExtensionProtocolHandler(is_incognito, extension_info_map)); | 583 new ExtensionProtocolHandler(is_incognito, extension_info_map)); |
583 } | 584 } |
584 | 585 |
585 } // namespace extensions | 586 } // namespace extensions |
OLD | NEW |