| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 230     // TODO(asargent) - we'll need to add proper support for range headers. | 230     // TODO(asargent) - we'll need to add proper support for range headers. | 
| 231     // crbug.com/369895. | 231     // crbug.com/369895. | 
| 232     std::string range_header; | 232     std::string range_header; | 
| 233     if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) { | 233     if (headers.GetHeader(net::HttpRequestHeaders::kRange, &range_header)) { | 
| 234       if (verify_job_.get()) | 234       if (verify_job_.get()) | 
| 235         verify_job_ = NULL; | 235         verify_job_ = NULL; | 
| 236     } | 236     } | 
| 237     URLRequestFileJob::SetExtraRequestHeaders(headers); | 237     URLRequestFileJob::SetExtraRequestHeaders(headers); | 
| 238   } | 238   } | 
| 239 | 239 | 
|  | 240   void OnOpenComplete(int result) override { | 
|  | 241     if (result < 0) { | 
|  | 242       // This can happen when the file is unreadable (which can happen during | 
|  | 243       // corruption or third-party interaction). We need to be sure to inform | 
|  | 244       // the verification job that we've finished reading so that it can | 
|  | 245       // proceed; see crbug.com/703888. | 
|  | 246       if (verify_job_.get()) { | 
|  | 247         std::string tmp; | 
|  | 248         verify_job_->BytesRead(0, base::string_as_array(&tmp)); | 
|  | 249         verify_job_->DoneReading(); | 
|  | 250       } | 
|  | 251     } | 
|  | 252   } | 
|  | 253 | 
| 240   void OnSeekComplete(int64_t result) override { | 254   void OnSeekComplete(int64_t result) override { | 
| 241     DCHECK_EQ(seek_position_, 0); | 255     DCHECK_EQ(seek_position_, 0); | 
| 242     seek_position_ = result; | 256     seek_position_ = result; | 
| 243     // TODO(asargent) - we'll need to add proper support for range headers. | 257     // TODO(asargent) - we'll need to add proper support for range headers. | 
| 244     // crbug.com/369895. | 258     // crbug.com/369895. | 
| 245     if (result > 0 && verify_job_.get()) | 259     if (result > 0 && verify_job_.get()) | 
| 246       verify_job_ = NULL; | 260       verify_job_ = NULL; | 
| 247   } | 261   } | 
| 248 | 262 | 
| 249   void OnReadComplete(net::IOBuffer* buffer, int result) override { | 263   void OnReadComplete(net::IOBuffer* buffer, int result) override { | 
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 597                                extensions::InfoMap* extension_info_map) { | 611                                extensions::InfoMap* extension_info_map) { | 
| 598   return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, | 612   return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, | 
| 599                                                     extension_info_map); | 613                                                     extension_info_map); | 
| 600 } | 614 } | 
| 601 | 615 | 
| 602 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) { | 616 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) { | 
| 603   g_test_handler = handler; | 617   g_test_handler = handler; | 
| 604 } | 618 } | 
| 605 | 619 | 
| 606 }  // namespace extensions | 620 }  // namespace extensions | 
| OLD | NEW | 
|---|