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

Side by Side Diff: pdf/document_loader.cc

Issue 1233453011: Revert of Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « net/websockets/websocket_stream_cookie_test.cc ('k') | remoting/host/it2me/it2me_host.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "pdf/document_loader.h" 5 #include "pdf/document_loader.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "net/http/http_util.h" 9 #include "net/http/http_util.h"
10 #include "ppapi/c/pp_errors.h" 10 #include "ppapi/c/pp_errors.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 return std::string(boundary + 9); 63 return std::string(boundary + 9);
64 } 64 }
65 } 65 }
66 } 66 }
67 return std::string(); 67 return std::string();
68 } 68 }
69 69
70 bool IsValidContentType(const std::string& type) { 70 bool IsValidContentType(const std::string& type) {
71 return (base::EndsWith(type, "/pdf", base::CompareCase::INSENSITIVE_ASCII) || 71 return (base::EndsWith(type, "/pdf", false) ||
72 base::EndsWith(type, ".pdf", base::CompareCase::INSENSITIVE_ASCII) || 72 base::EndsWith(type, ".pdf", false) ||
73 base::EndsWith(type, "/x-pdf", 73 base::EndsWith(type, "/x-pdf", false) ||
74 base::CompareCase::INSENSITIVE_ASCII) || 74 base::EndsWith(type, "/*", false) ||
75 base::EndsWith(type, "/*", base::CompareCase::INSENSITIVE_ASCII) || 75 base::EndsWith(type, "/acrobat", false) ||
76 base::EndsWith(type, "/acrobat", 76 base::EndsWith(type, "/unknown", false));
77 base::CompareCase::INSENSITIVE_ASCII) ||
78 base::EndsWith(type, "/unknown",
79 base::CompareCase::INSENSITIVE_ASCII));
80 } 77 }
81 78
82 } // namespace 79 } // namespace
83 80
84 DocumentLoader::Client::~Client() { 81 DocumentLoader::Client::~Client() {
85 } 82 }
86 83
87 DocumentLoader::DocumentLoader(Client* client) 84 DocumentLoader::DocumentLoader(Client* client)
88 : client_(client), partial_document_(false), request_pending_(false), 85 : client_(client), partial_document_(false), request_pending_(false),
89 current_pos_(0), current_chunk_size_(0), current_chunk_read_(0), 86 current_pos_(0), current_chunk_size_(0), current_chunk_read_(0),
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 uint32_t DocumentLoader::GetRequestSize() const { 526 uint32_t DocumentLoader::GetRequestSize() const {
530 // Document loading strategy: 527 // Document loading strategy:
531 // For first 10 requests, we use 32k chunk sizes, for the next 10 requests we 528 // For first 10 requests, we use 32k chunk sizes, for the next 10 requests we
532 // double the size (64k), and so on, until we cap max request size at 2M for 529 // double the size (64k), and so on, until we cap max request size at 2M for
533 // 71 or more requests. 530 // 71 or more requests.
534 uint32_t limited_count = std::min(std::max(requests_count_, 10u), 70u); 531 uint32_t limited_count = std::min(std::max(requests_count_, 10u), 70u);
535 return 32 * 1024 * (1 << ((limited_count - 1) / 10u)); 532 return 32 * 1024 * (1 << ((limited_count - 1) / 10u));
536 } 533 }
537 534
538 } // namespace chrome_pdf 535 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « net/websockets/websocket_stream_cookie_test.cc ('k') | remoting/host/it2me/it2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698