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

Side by Side Diff: content/browser/download/download_stats.cc

Issue 1107913003: Remove support for "name" parameter from Content-Disposition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | net/base/filename_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/download/download_stats.h" 5 #include "content/browser/download/download_stats.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "content/browser/download/download_resource_handler.h" 10 #include "content/browser/download/download_resource_handler.h"
(...skipping 21 matching lines...) Expand all
32 CONTENT_DISPOSITION_HEADER_PRESENT = 0, 32 CONTENT_DISPOSITION_HEADER_PRESENT = 0,
33 33
34 // At least one of 'name', 'filename' or 'filenae*' attributes were valid and 34 // At least one of 'name', 'filename' or 'filenae*' attributes were valid and
35 // yielded a non-empty filename. 35 // yielded a non-empty filename.
36 CONTENT_DISPOSITION_IS_VALID, 36 CONTENT_DISPOSITION_IS_VALID,
37 37
38 // The following enum values correspond to 38 // The following enum values correspond to
39 // net::HttpContentDisposition::ParseResult. 39 // net::HttpContentDisposition::ParseResult.
40 CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE, 40 CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE,
41 CONTENT_DISPOSITION_HAS_UNKNOWN_TYPE, 41 CONTENT_DISPOSITION_HAS_UNKNOWN_TYPE,
42
43 // Support removed. Kept for UMA compatiblity.
42 CONTENT_DISPOSITION_HAS_NAME, 44 CONTENT_DISPOSITION_HAS_NAME,
asanka 2015/04/28 00:33:44 It looks like the comment applies to all the enum
43 CONTENT_DISPOSITION_HAS_FILENAME, 45 CONTENT_DISPOSITION_HAS_FILENAME,
44 CONTENT_DISPOSITION_HAS_EXT_FILENAME, 46 CONTENT_DISPOSITION_HAS_EXT_FILENAME,
45 CONTENT_DISPOSITION_HAS_NON_ASCII_STRINGS, 47 CONTENT_DISPOSITION_HAS_NON_ASCII_STRINGS,
46 CONTENT_DISPOSITION_HAS_PERCENT_ENCODED_STRINGS, 48 CONTENT_DISPOSITION_HAS_PERCENT_ENCODED_STRINGS,
47 CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS, 49 CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS,
48 50
49 // Only have the 'name' attribute is present. 51 // Support removed. Kept for UMA compatiblity.
50 CONTENT_DISPOSITION_HAS_NAME_ONLY, 52 CONTENT_DISPOSITION_HAS_NAME_ONLY,
51 53
52 CONTENT_DISPOSITION_LAST_ENTRY 54 CONTENT_DISPOSITION_LAST_ENTRY
53 }; 55 };
54 56
55 void RecordContentDispositionCount(ContentDispositionCountTypes type, 57 void RecordContentDispositionCount(ContentDispositionCountTypes type,
56 bool record) { 58 bool record) {
57 if (!record) 59 if (!record)
58 return; 60 return;
59 UMA_HISTOGRAM_ENUMERATION( 61 UMA_HISTOGRAM_ENUMERATION(
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (!is_valid) 500 if (!is_valid)
499 return; 501 return;
500 502
501 RecordContentDispositionCountFlag( 503 RecordContentDispositionCountFlag(
502 CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE, result, 504 CONTENT_DISPOSITION_HAS_DISPOSITION_TYPE, result,
503 net::HttpContentDisposition::HAS_DISPOSITION_TYPE); 505 net::HttpContentDisposition::HAS_DISPOSITION_TYPE);
504 RecordContentDispositionCountFlag( 506 RecordContentDispositionCountFlag(
505 CONTENT_DISPOSITION_HAS_UNKNOWN_TYPE, result, 507 CONTENT_DISPOSITION_HAS_UNKNOWN_TYPE, result,
506 net::HttpContentDisposition::HAS_UNKNOWN_DISPOSITION_TYPE); 508 net::HttpContentDisposition::HAS_UNKNOWN_DISPOSITION_TYPE);
507 RecordContentDispositionCountFlag( 509 RecordContentDispositionCountFlag(
508 CONTENT_DISPOSITION_HAS_NAME, result,
509 net::HttpContentDisposition::HAS_NAME);
510 RecordContentDispositionCountFlag(
511 CONTENT_DISPOSITION_HAS_FILENAME, result, 510 CONTENT_DISPOSITION_HAS_FILENAME, result,
512 net::HttpContentDisposition::HAS_FILENAME); 511 net::HttpContentDisposition::HAS_FILENAME);
513 RecordContentDispositionCountFlag( 512 RecordContentDispositionCountFlag(
514 CONTENT_DISPOSITION_HAS_EXT_FILENAME, result, 513 CONTENT_DISPOSITION_HAS_EXT_FILENAME, result,
515 net::HttpContentDisposition::HAS_EXT_FILENAME); 514 net::HttpContentDisposition::HAS_EXT_FILENAME);
516 RecordContentDispositionCountFlag( 515 RecordContentDispositionCountFlag(
517 CONTENT_DISPOSITION_HAS_NON_ASCII_STRINGS, result, 516 CONTENT_DISPOSITION_HAS_NON_ASCII_STRINGS, result,
518 net::HttpContentDisposition::HAS_NON_ASCII_STRINGS); 517 net::HttpContentDisposition::HAS_NON_ASCII_STRINGS);
519 RecordContentDispositionCountFlag( 518 RecordContentDispositionCountFlag(
520 CONTENT_DISPOSITION_HAS_PERCENT_ENCODED_STRINGS, result, 519 CONTENT_DISPOSITION_HAS_PERCENT_ENCODED_STRINGS, result,
521 net::HttpContentDisposition::HAS_PERCENT_ENCODED_STRINGS); 520 net::HttpContentDisposition::HAS_PERCENT_ENCODED_STRINGS);
522 RecordContentDispositionCountFlag( 521 RecordContentDispositionCountFlag(
523 CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS, result, 522 CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS, result,
524 net::HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS); 523 net::HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS);
525
526 RecordContentDispositionCount(
527 CONTENT_DISPOSITION_HAS_NAME_ONLY,
528 (result & (net::HttpContentDisposition::HAS_NAME |
529 net::HttpContentDisposition::HAS_FILENAME |
530 net::HttpContentDisposition::HAS_EXT_FILENAME)) ==
531 net::HttpContentDisposition::HAS_NAME);
532 } 524 }
533 525
534 void RecordFileThreadReceiveBuffers(size_t num_buffers) { 526 void RecordFileThreadReceiveBuffers(size_t num_buffers) {
535 UMA_HISTOGRAM_CUSTOM_COUNTS( 527 UMA_HISTOGRAM_CUSTOM_COUNTS(
536 "Download.FileThreadReceiveBuffers", num_buffers, 1, 528 "Download.FileThreadReceiveBuffers", num_buffers, 1,
537 100, 100); 529 100, 100);
538 } 530 }
539 531
540 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth) { 532 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth) {
541 UMA_HISTOGRAM_CUSTOM_COUNTS( 533 UMA_HISTOGRAM_CUSTOM_COUNTS(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 int state) { 625 int state) {
634 if (is_partial) 626 if (is_partial)
635 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state, 627 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state,
636 ORIGIN_STATE_ON_RESUMPTION_MAX); 628 ORIGIN_STATE_ON_RESUMPTION_MAX);
637 else 629 else
638 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state, 630 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state,
639 ORIGIN_STATE_ON_RESUMPTION_MAX); 631 ORIGIN_STATE_ON_RESUMPTION_MAX);
640 } 632 }
641 633
642 } // namespace content 634 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | net/base/filename_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698