| OLD | NEW |
| 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/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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 UTF16ToUTF8(desired_tld)); | 142 UTF16ToUTF8(desired_tld)); |
| 143 } | 143 } |
| 144 | 144 |
| 145 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileScheme)) { | 145 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileScheme)) { |
| 146 // A user might or might not type a scheme when entering a file URL. In | 146 // A user might or might not type a scheme when entering a file URL. In |
| 147 // either case, |parsed_scheme| will tell us that this is a file URL, but | 147 // either case, |parsed_scheme| will tell us that this is a file URL, but |
| 148 // |parts->scheme| might be empty, e.g. if the user typed "C:\foo". | 148 // |parts->scheme| might be empty, e.g. if the user typed "C:\foo". |
| 149 return URL; | 149 return URL; |
| 150 } | 150 } |
| 151 | 151 |
| 152 // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it | 152 // If the user typed a scheme, and it's HTTP, HTTPS, or HTTPSV we know how to |
| 153 // well enough that we can fall through to the heuristics below. If it's | 153 // parse it well enough that we can fall through to the heuristics below. If |
| 154 // something else, we can just determine our action based on what we do with | 154 // it's something else, we can just determine our action based on what we do |
| 155 // any input of this scheme. In theory we could do better with some schemes | 155 // with any input of this scheme. In theory we could do better with some |
| 156 // (e.g. "ftp" or "view-source") but I'll wait to spend the effort on that | 156 // schemes (e.g. "ftp" or "view-source") but I'll wait to spend the effort on |
| 157 // until I run into some cases that really need it. | 157 // that until I run into some cases that really need it. |
| 158 if (parts->scheme.is_nonempty() && | 158 if (parts->scheme.is_nonempty() && |
| 159 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpScheme) && | 159 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpScheme) && |
| 160 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpsScheme)) { | 160 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpsScheme) && |
| 161 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpsvScheme)) { |
| 161 // See if we know how to handle the URL internally. | 162 // See if we know how to handle the URL internally. |
| 162 if (net::URLRequest::IsHandledProtocol(UTF16ToASCII(parsed_scheme))) | 163 if (net::URLRequest::IsHandledProtocol(UTF16ToASCII(parsed_scheme))) |
| 163 return URL; | 164 return URL; |
| 164 | 165 |
| 165 // There are also some schemes that we convert to other things before they | 166 // There are also some schemes that we convert to other things before they |
| 166 // reach the renderer or else the renderer handles internally without | 167 // reach the renderer or else the renderer handles internally without |
| 167 // reaching the net::URLRequest logic. We thus won't catch these above, but | 168 // reaching the net::URLRequest logic. We thus won't catch these above, but |
| 168 // we should still claim to handle them. | 169 // we should still claim to handle them. |
| 169 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kViewSourceScheme) || | 170 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kViewSourceScheme) || |
| 170 LowerCaseEqualsASCII(parsed_scheme, chrome::kJavaScriptScheme) || | 171 LowerCaseEqualsASCII(parsed_scheme, chrome::kJavaScriptScheme) || |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 } | 973 } |
| 973 } | 974 } |
| 974 done_ = true; | 975 done_ = true; |
| 975 } | 976 } |
| 976 | 977 |
| 977 void AutocompleteController::StartExpireTimer() { | 978 void AutocompleteController::StartExpireTimer() { |
| 978 if (result_.HasCopiedMatches()) | 979 if (result_.HasCopiedMatches()) |
| 979 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), | 980 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), |
| 980 this, &AutocompleteController::ExpireCopiedEntries); | 981 this, &AutocompleteController::ExpireCopiedEntries); |
| 981 } | 982 } |
| OLD | NEW |