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

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

Issue 23658056: content: Move kHttpScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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) 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 "chrome/browser/autocomplete/history_provider.h" 5 #include "chrome/browser/autocomplete/history_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 input->UpdateText(output, string16::npos, parts); 131 input->UpdateText(output, string16::npos, parts);
132 return !output.empty(); 132 return !output.empty();
133 } 133 }
134 134
135 // static 135 // static
136 size_t HistoryProvider::TrimHttpPrefix(string16* url) { 136 size_t HistoryProvider::TrimHttpPrefix(string16* url) {
137 // Find any "http:". 137 // Find any "http:".
138 if (!HasHTTPScheme(*url)) 138 if (!HasHTTPScheme(*url))
139 return 0; 139 return 0;
140 size_t scheme_pos = 140 size_t scheme_pos =
141 url->find(ASCIIToUTF16(chrome::kHttpScheme) + char16(':')); 141 url->find(ASCIIToUTF16(content::kHttpScheme) + char16(':'));
142 DCHECK_NE(string16::npos, scheme_pos); 142 DCHECK_NE(string16::npos, scheme_pos);
143 143
144 // Erase scheme plus up to two slashes. 144 // Erase scheme plus up to two slashes.
145 size_t prefix_end = scheme_pos + strlen(chrome::kHttpScheme) + 1; 145 size_t prefix_end = scheme_pos + strlen(content::kHttpScheme) + 1;
146 const size_t after_slashes = std::min(url->length(), prefix_end + 2); 146 const size_t after_slashes = std::min(url->length(), prefix_end + 2);
147 while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/')) 147 while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/'))
148 ++prefix_end; 148 ++prefix_end;
149 url->erase(scheme_pos, prefix_end - scheme_pos); 149 url->erase(scheme_pos, prefix_end - scheme_pos);
150 return (scheme_pos == 0) ? prefix_end : 0; 150 return (scheme_pos == 0) ? prefix_end : 0;
151 } 151 }
152 152
153 // static 153 // static
154 bool HistoryProvider::PreventInlineAutocomplete( 154 bool HistoryProvider::PreventInlineAutocomplete(
155 const AutocompleteInput& input) { 155 const AutocompleteInput& input) {
156 return input.prevent_inline_autocomplete() || 156 return input.prevent_inline_autocomplete() ||
157 (!input.text().empty() && 157 (!input.text().empty() &&
158 IsWhitespace(input.text()[input.text().length() - 1])); 158 IsWhitespace(input.text()[input.text().length() - 1]));
159 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_provider.cc ('k') | chrome/browser/autocomplete/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698