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

Side by Side Diff: chrome/browser/autocomplete/history_provider.cc

Issue 6539002: Begun the DCHECK() cleanup. Starting off with /src/chrome/a* and /src/chrome/... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 10 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
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 "chrome/browser/autocomplete/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return output; 128 return output;
129 } 129 }
130 130
131 // static 131 // static
132 size_t HistoryProvider::TrimHttpPrefix(string16* url) { 132 size_t HistoryProvider::TrimHttpPrefix(string16* url) {
133 // Find any "http:". 133 // Find any "http:".
134 if (!HasHTTPScheme(*url)) 134 if (!HasHTTPScheme(*url))
135 return 0; 135 return 0;
136 size_t scheme_pos = 136 size_t scheme_pos =
137 url->find(ASCIIToUTF16(chrome::kHttpScheme) + char16(':')); 137 url->find(ASCIIToUTF16(chrome::kHttpScheme) + char16(':'));
138 DCHECK(scheme_pos != string16::npos); 138 DCHECK_NE(scheme_pos, string16::npos);
139 139
140 // Erase scheme plus up to two slashes. 140 // Erase scheme plus up to two slashes.
141 size_t prefix_end = scheme_pos + strlen(chrome::kHttpScheme) + 1; 141 size_t prefix_end = scheme_pos + strlen(chrome::kHttpScheme) + 1;
142 const size_t after_slashes = std::min(url->length(), prefix_end + 2); 142 const size_t after_slashes = std::min(url->length(), prefix_end + 2);
143 while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/')) 143 while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/'))
144 ++prefix_end; 144 ++prefix_end;
145 url->erase(scheme_pos, prefix_end - scheme_pos); 145 url->erase(scheme_pos, prefix_end - scheme_pos);
146 return (scheme_pos == 0) ? prefix_end : 0; 146 return (scheme_pos == 0) ? prefix_end : 0;
147 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698