Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 // Fixes up user URL input to make it more possible to match against. Among | 250 // Fixes up user URL input to make it more possible to match against. Among |
| 251 // many other things, this takes care of the following: | 251 // many other things, this takes care of the following: |
| 252 // * Prepending file:// to file URLs | 252 // * Prepending file:// to file URLs |
| 253 // * Converting drive letters in file URLs to uppercase | 253 // * Converting drive letters in file URLs to uppercase |
| 254 // * Converting case-insensitive parts of URLs (like the scheme and domain) | 254 // * Converting case-insensitive parts of URLs (like the scheme and domain) |
| 255 // to lowercase | 255 // to lowercase |
| 256 // * Convert spaces to %20s | 256 // * Convert spaces to %20s |
| 257 // Note that we don't do this in AutocompleteInput's constructor, because if | 257 // Note that we don't do this in AutocompleteInput's constructor, because if |
| 258 // e.g. we convert a Unicode hostname to punycode, other providers will show | 258 // e.g. we convert a Unicode hostname to punycode, other providers will show |
| 259 // output that surprises the user ("Search Google for xn--6ca.com"). | 259 // output that surprises the user ("Search Google for xn--6ca.com"). |
| 260 // Returns false if the fixup attempt resulted in an empty string (which | 260 // If fixup fails, this function either returns the empty string or the |
| 261 // providers generally can't do anything with). | 261 // original input text, depending on the value of |return_input_on_failure|. |
| 262 static bool FixupUserInput(AutocompleteInput* input); | 262 static base::string16 FixupUserInput(const AutocompleteInput& input, |
| 263 bool return_input_on_failure); | |
|
Mark P
2014/06/06 18:07:41
This is awkward. Why not use two outparams or ret
Peter Kasting
2014/06/06 18:29:08
Switched to returning a pair.
| |
| 263 | 264 |
| 264 // Trims "http:" and up to two subsequent slashes from |url|. Returns the | 265 // Trims "http:" and up to two subsequent slashes from |url|. Returns the |
| 265 // number of characters that were trimmed. | 266 // number of characters that were trimmed. |
| 266 // NOTE: For a view-source: URL, this will trim from after "view-source:" and | 267 // NOTE: For a view-source: URL, this will trim from after "view-source:" and |
| 267 // return 0. | 268 // return 0. |
| 268 static size_t TrimHttpPrefix(base::string16* url); | 269 static size_t TrimHttpPrefix(base::string16* url); |
| 269 | 270 |
| 270 // The profile associated with the AutocompleteProvider. Reference is not | 271 // The profile associated with the AutocompleteProvider. Reference is not |
| 271 // owned by us. | 272 // owned by us. |
| 272 Profile* profile_; | 273 Profile* profile_; |
| 273 | 274 |
| 274 AutocompleteProviderListener* listener_; | 275 AutocompleteProviderListener* listener_; |
| 275 ACMatches matches_; | 276 ACMatches matches_; |
| 276 bool done_; | 277 bool done_; |
| 277 | 278 |
| 278 Type type_; | 279 Type type_; |
| 279 | 280 |
| 280 private: | 281 private: |
| 281 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); | 282 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); |
| 282 }; | 283 }; |
| 283 | 284 |
| 284 typedef std::vector<AutocompleteProvider*> ACProviders; | 285 typedef std::vector<AutocompleteProvider*> ACProviders; |
| 285 | 286 |
| 286 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 287 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| OLD | NEW |