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

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

Issue 2779083005: Make content verification see 0-byte files. (Closed)
Patch Set: sync Created 3 years, 8 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
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 262
263 void OnReadComplete(net::IOBuffer* buffer, int result) override { 263 void OnReadComplete(net::IOBuffer* buffer, int result) override {
264 if (result >= 0) 264 if (result >= 0)
265 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.OnReadCompleteResult", result); 265 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.OnReadCompleteResult", result);
266 else 266 else
267 UMA_HISTOGRAM_SPARSE_SLOWLY("ExtensionUrlRequest.OnReadCompleteError", 267 UMA_HISTOGRAM_SPARSE_SLOWLY("ExtensionUrlRequest.OnReadCompleteError",
268 -result); 268 -result);
269 if (result > 0) { 269 if (result > 0) {
270 bytes_read_ += result; 270 bytes_read_ += result;
271 if (verify_job_.get()) { 271 if (verify_job_.get())
272 verify_job_->BytesRead(result, buffer->data()); 272 verify_job_->BytesRead(result, buffer->data());
273 if (!remaining_bytes())
274 verify_job_->DoneReading();
275 }
276 } 273 }
277 } 274 }
278 275
276 void DoneReading() override {
277 URLRequestFileJob::DoneReading();
278 if (verify_job_.get())
279 verify_job_->DoneReading();
280 }
281
279 private: 282 private:
280 ~URLRequestExtensionJob() override { 283 ~URLRequestExtensionJob() override {
281 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.TotalKbRead", bytes_read_ / 1024); 284 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.TotalKbRead", bytes_read_ / 1024);
282 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.SeekPosition", seek_position_); 285 UMA_HISTOGRAM_COUNTS("ExtensionUrlRequest.SeekPosition", seek_position_);
283 if (request_timer_.get()) 286 if (request_timer_.get())
284 UMA_HISTOGRAM_TIMES("ExtensionUrlRequest.Latency", 287 UMA_HISTOGRAM_TIMES("ExtensionUrlRequest.Latency",
285 request_timer_->Elapsed()); 288 request_timer_->Elapsed());
286 } 289 }
287 290
288 void OnFilePathAndLastModifiedTimeRead(base::FilePath* read_file_path, 291 void OnFilePathAndLastModifiedTimeRead(base::FilePath* read_file_path,
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 extensions::InfoMap* extension_info_map) { 614 extensions::InfoMap* extension_info_map) {
612 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito, 615 return base::MakeUnique<ExtensionProtocolHandler>(is_incognito,
613 extension_info_map); 616 extension_info_map);
614 } 617 }
615 618
616 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) { 619 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler) {
617 g_test_handler = handler; 620 g_test_handler = handler;
618 } 621 }
619 622
620 } // namespace extensions 623 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698