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 #include "chrome/browser/autocomplete/autocomplete_input.h" | 5 #include "chrome/browser/autocomplete/autocomplete_input.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
10 #include "chrome/browser/profiles/profile_io_data.h" | 10 #include "chrome/browser/profiles/profile_io_data.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it | 168 // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it |
169 // well enough that we can fall through to the heuristics below. If it's | 169 // well enough that we can fall through to the heuristics below. If it's |
170 // something else, we can just determine our action based on what we do with | 170 // something else, we can just determine our action based on what we do with |
171 // any input of this scheme. In theory we could do better with some schemes | 171 // any input of this scheme. In theory we could do better with some schemes |
172 // (e.g. "ftp" or "view-source") but I'll wait to spend the effort on that | 172 // (e.g. "ftp" or "view-source") but I'll wait to spend the effort on that |
173 // until I run into some cases that really need it. | 173 // until I run into some cases that really need it. |
174 if (parts->scheme.is_nonempty() && | 174 if (parts->scheme.is_nonempty() && |
175 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpScheme) && | 175 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpScheme) && |
176 !LowerCaseEqualsASCII(parsed_scheme, chrome::kHttpsScheme)) { | 176 !LowerCaseEqualsASCII(parsed_scheme, content::kHttpsScheme)) { |
177 // See if we know how to handle the URL internally. | 177 // See if we know how to handle the URL internally. |
178 if (ProfileIOData::IsHandledProtocol(UTF16ToASCII(parsed_scheme))) | 178 if (ProfileIOData::IsHandledProtocol(UTF16ToASCII(parsed_scheme))) |
179 return URL; | 179 return URL; |
180 | 180 |
181 // There are also some schemes that we convert to other things before they | 181 // There are also some schemes that we convert to other things before they |
182 // reach the renderer or else the renderer handles internally without | 182 // reach the renderer or else the renderer handles internally without |
183 // reaching the net::URLRequest logic. We thus won't catch these above, but | 183 // reaching the net::URLRequest logic. We thus won't catch these above, but |
184 // we should still claim to handle them. | 184 // we should still claim to handle them. |
185 if (LowerCaseEqualsASCII(parsed_scheme, content::kViewSourceScheme) || | 185 if (LowerCaseEqualsASCII(parsed_scheme, content::kViewSourceScheme) || |
186 LowerCaseEqualsASCII(parsed_scheme, content::kJavaScriptScheme) || | 186 LowerCaseEqualsASCII(parsed_scheme, content::kJavaScriptScheme) || |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 current_page_classification_ = AutocompleteInput::INVALID_SPEC; | 514 current_page_classification_ = AutocompleteInput::INVALID_SPEC; |
515 type_ = INVALID; | 515 type_ = INVALID; |
516 parts_ = url_parse::Parsed(); | 516 parts_ = url_parse::Parsed(); |
517 scheme_.clear(); | 517 scheme_.clear(); |
518 canonicalized_url_ = GURL(); | 518 canonicalized_url_ = GURL(); |
519 prevent_inline_autocomplete_ = false; | 519 prevent_inline_autocomplete_ = false; |
520 prefer_keyword_ = false; | 520 prefer_keyword_ = false; |
521 allow_exact_keyword_match_ = false; | 521 allow_exact_keyword_match_ = false; |
522 matches_requested_ = ALL_MATCHES; | 522 matches_requested_ = ALL_MATCHES; |
523 } | 523 } |
OLD | NEW |