OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete.h" | 5 #include "chrome/browser/autocomplete/autocomplete.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 return URL; | 352 return URL; |
353 | 353 |
354 // Presence of a password means this is likely a URL. Note that unless the | 354 // Presence of a password means this is likely a URL. Note that unless the |
355 // user has typed an explicit "http://" or similar, we'll probably think that | 355 // user has typed an explicit "http://" or similar, we'll probably think that |
356 // the username is some unknown scheme, and bail out in the scheme-handling | 356 // the username is some unknown scheme, and bail out in the scheme-handling |
357 // code above. | 357 // code above. |
358 if (parts->password.is_nonempty()) | 358 if (parts->password.is_nonempty()) |
359 return URL; | 359 return URL; |
360 | 360 |
361 // Trailing slashes force the input to be treated as a URL. | 361 // Trailing slashes force the input to be treated as a URL. |
362 if (parts->path.len == 1) | 362 if (parts->path.is_nonempty()) { |
363 return URL; | 363 char c = text[parts->path.end() - 1]; |
| 364 if ((c == '\\') || (c == '/')) |
| 365 return URL; |
| 366 } |
364 | 367 |
365 // If there is more than one recognized non-host component, this is likely to | 368 // If there is more than one recognized non-host component, this is likely to |
366 // be a URL, even if the TLD is unknown (in which case this is likely an | 369 // be a URL, even if the TLD is unknown (in which case this is likely an |
367 // intranet URL). | 370 // intranet URL). |
368 if (NumNonHostComponents(*parts) > 1) | 371 if (NumNonHostComponents(*parts) > 1) |
369 return URL; | 372 return URL; |
370 | 373 |
371 // If the host has a known TLD, it's probably a URL, with the following | 374 // If the host has a known TLD, it's probably a URL, with the following |
372 // exceptions: | 375 // exceptions: |
373 // * Any "IP addresses" that make it here are more likely searches | 376 // * Any "IP addresses" that make it here are more likely searches |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 } | 1046 } |
1044 done_ = true; | 1047 done_ = true; |
1045 } | 1048 } |
1046 | 1049 |
1047 void AutocompleteController::StartExpireTimer() { | 1050 void AutocompleteController::StartExpireTimer() { |
1048 if (result_.HasCopiedMatches()) | 1051 if (result_.HasCopiedMatches()) |
1049 expire_timer_.Start(FROM_HERE, | 1052 expire_timer_.Start(FROM_HERE, |
1050 base::TimeDelta::FromMilliseconds(kExpireTimeMS), | 1053 base::TimeDelta::FromMilliseconds(kExpireTimeMS), |
1051 this, &AutocompleteController::ExpireCopiedEntries); | 1054 this, &AutocompleteController::ExpireCopiedEntries); |
1052 } | 1055 } |
OLD | NEW |