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

Side by Side Diff: net/base/mime_sniffer.cc

Issue 515033: Cleanup histogram classes mixing SetFlags into FactoryGet arguments... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « net/base/connection_type_histograms.cc ('k') | net/base/sdch_manager.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Detecting mime types is a tricky business because we need to balance 5 // Detecting mime types is a tricky business because we need to balance
6 // compatibility concerns with security issues. Here is a survey of how other 6 // compatibility concerns with security issues. Here is a survey of how other
7 // browsers behave and then a description of how we intend to behave. 7 // browsers behave and then a description of how we intend to behave.
8 // 8 //
9 // HTML payload, no Content-Type header: 9 // HTML payload, no Content-Type header:
10 // * IE 7: Render as HTML 10 // * IE 7: Render as HTML
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 MAGIC_HTML_TAG("title") // Mozilla 206 MAGIC_HTML_TAG("title") // Mozilla
207 MAGIC_HTML_TAG("b") // Mozilla 207 MAGIC_HTML_TAG("b") // Mozilla
208 MAGIC_HTML_TAG("body") // Mozilla 208 MAGIC_HTML_TAG("body") // Mozilla
209 MAGIC_HTML_TAG("br") 209 MAGIC_HTML_TAG("br")
210 MAGIC_HTML_TAG("p") // Mozilla 210 MAGIC_HTML_TAG("p") // Mozilla
211 }; 211 };
212 212
213 static scoped_refptr<Histogram> UMASnifferHistogramGet(const char* name, 213 static scoped_refptr<Histogram> UMASnifferHistogramGet(const char* name,
214 int array_size) { 214 int array_size) {
215 scoped_refptr<Histogram> counter = 215 scoped_refptr<Histogram> counter =
216 LinearHistogram::LinearHistogramFactoryGet( 216 LinearHistogram::FactoryGet(name, 1, array_size - 1, array_size,
217 name, 1, array_size - 1, array_size); 217 Histogram::kUmaTargetedHistogramFlag);
218 counter->SetFlags(kUmaTargetedHistogramFlag);
219 return counter; 218 return counter;
220 } 219 }
221 220
222 static bool MatchMagicNumber(const char* content, size_t size, 221 static bool MatchMagicNumber(const char* content, size_t size,
223 const MagicNumber* magic_entry, 222 const MagicNumber* magic_entry,
224 std::string* result) { 223 std::string* result) {
225 const size_t len = magic_entry->magic_len; 224 const size_t len = magic_entry->magic_len;
226 225
227 // Keep kBytesRequiredForMagic honest. 226 // Keep kBytesRequiredForMagic honest.
228 DCHECK(len <= kBytesRequiredForMagic); 227 DCHECK(len <= kBytesRequiredForMagic);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 result->assign("text/plain"); 602 result->assign("text/plain");
604 // We could change our mind if a binary-looking byte appears later in 603 // We could change our mind if a binary-looking byte appears later in
605 // the content, so we only have enough content if we have the max. 604 // the content, so we only have enough content if we have the max.
606 return content_size >= kMaxBytesToSniff; 605 return content_size >= kMaxBytesToSniff;
607 } 606 }
608 607
609 return have_enough_content; 608 return have_enough_content;
610 } 609 }
611 610
612 } // namespace net 611 } // namespace net
OLDNEW
« no previous file with comments | « net/base/connection_type_histograms.cc ('k') | net/base/sdch_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698