| 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> |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 private: | 278 private: |
| 279 ~URLRequestExtensionJob() override { | 279 ~URLRequestExtensionJob() override { |
| 280 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.TotalKbRead", bytes_read_ / 1024); | 280 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.TotalKbRead", bytes_read_ / 1024); |
| 281 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.SeekPosition", seek_position_); | 281 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.SeekPosition", seek_position_); |
| 282 if (request_timer_.get()) | 282 if (request_timer_.get()) |
| 283 UMA_HISTOGRAM_TIMES("ExtensionUrlRequest.Latency", | 283 UMA_HISTOGRAM_TIMES("ExtensionUrlRequest.Latency", |
| 284 request_timer_->Elapsed()); | 284 request_timer_->Elapsed()); |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool CanAccessFile(const base::FilePath& original_path, |
| 288 const base::FilePath& absolute_path) override { |
| 289 // The access checks for the file are performed before the job is |
| 290 // created, so we should know that this is safe. |
| 291 DCHECK(directory_path_.IsParent(original_path)); |
| 292 return true; |
| 293 } |
| 294 |
| 287 void OnFilePathAndLastModifiedTimeRead(base::FilePath* read_file_path, | 295 void OnFilePathAndLastModifiedTimeRead(base::FilePath* read_file_path, |
| 288 base::Time* last_modified_time) { | 296 base::Time* last_modified_time) { |
| 289 file_path_ = *read_file_path; | 297 file_path_ = *read_file_path; |
| 290 response_info_.headers = BuildHttpHeaders( | 298 response_info_.headers = BuildHttpHeaders( |
| 291 content_security_policy_, | 299 content_security_policy_, |
| 292 send_cors_header_, | 300 send_cors_header_, |
| 293 *last_modified_time); | 301 *last_modified_time); |
| 294 URLRequestFileJob::Start(); | 302 URLRequestFileJob::Start(); |
| 295 } | 303 } |
| 296 | 304 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 extensions::InfoMap* extension_info_map) { | 618 extensions::InfoMap* extension_info_map) { |
| 611 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, | 619 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, |
| 612 extension_info_map); | 620 extension_info_map); |
| 613 } | 621 } |
| 614 | 622 |
| 615 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) { | 623 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) { |
| 616 g_test_handler = handler; | 624 g_test_handler = handler; |
| 617 } | 625 } |
| 618 | 626 |
| 619 } // namespace extensions | 627 } // namespace extensions |
| OLD | NEW |