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

Side by Side Diff: extensions/browser/extension_protocols.cc

Issue 2771953003: Fix content verification code for undreadable and deleted files. (Closed)
Patch Set: . Created 3 years, 9 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 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
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) {
Devlin 2017/03/24 02:01:45 This block would benefit from some comments. :)
lazyboy 2017/03/24 18:27:47 Done.
242 if (verify_job_.get()) {
243 std::string tmp;
244 verify_job_->BytesRead(0, base::string_as_array(&tmp));
245 verify_job_->DoneReading();
246 }
247 }
248 }
249
240 void OnSeekComplete(int64_t result) override { 250 void OnSeekComplete(int64_t result) override {
241 DCHECK_EQ(seek_position_, 0); 251 DCHECK_EQ(seek_position_, 0);
242 seek_position_ = result; 252 seek_position_ = result;
243 // TODO(asargent) - we'll need to add proper support for range headers. 253 // TODO(asargent) - we'll need to add proper support for range headers.
244 // crbug.com/369895. 254 // crbug.com/369895.
245 if (result > 0 && verify_job_.get()) 255 if (result > 0 && verify_job_.get())
246 verify_job_ = NULL; 256 verify_job_ = NULL;
247 } 257 }
248 258
249 void OnReadComplete(net::IOBuffer* buffer, int result) override { 259 void OnReadComplete(net::IOBuffer* buffer, int result) override {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 extensions::InfoMap* extension_info_map) { 607 extensions::InfoMap* extension_info_map) {
598 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, 608 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito,
599 extension_info_map); 609 extension_info_map);
600 } 610 }
601 611
602 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) { 612 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) {
603 g_test_handler = handler; 613 g_test_handler = handler;
604 } 614 }
605 615
606 } // namespace extensions 616 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698