| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 LowerCaseEqualsASCII(parsed_scheme, content::kJavaScriptScheme) || | 187 LowerCaseEqualsASCII(parsed_scheme, content::kJavaScriptScheme) || |
| 188 LowerCaseEqualsASCII(parsed_scheme, content::kDataScheme)) | 188 LowerCaseEqualsASCII(parsed_scheme, content::kDataScheme)) |
| 189 return URL; | 189 return URL; |
| 190 | 190 |
| 191 // Not an internal protocol. Check and see if the user has explicitly | 191 // Not an internal protocol. Check and see if the user has explicitly |
| 192 // opened this scheme as a URL before, or if the "scheme" is actually a | 192 // opened this scheme as a URL before, or if the "scheme" is actually a |
| 193 // username. We need to do this after the check above because some | 193 // username. We need to do this after the check above because some |
| 194 // handlable schemes (e.g. "javascript") may be treated as "blocked" by the | 194 // handlable schemes (e.g. "javascript") may be treated as "blocked" by the |
| 195 // external protocol handler because we don't want pages to open them, but | 195 // external protocol handler because we don't want pages to open them, but |
| 196 // users still can. | 196 // users still can. |
| 197 // Note that the protocol handler needs to be informed that omnibox input | |
| 198 // should always be considered "user gesture-triggered", lest it always | |
| 199 // return BLOCK. | |
| 200 ExternalProtocolHandler::BlockState block_state = | 197 ExternalProtocolHandler::BlockState block_state = |
| 201 ExternalProtocolHandler::GetBlockState( | 198 ExternalProtocolHandler::GetBlockState( |
| 202 base::UTF16ToUTF8(parsed_scheme), true); | 199 base::UTF16ToUTF8(parsed_scheme)); |
| 203 switch (block_state) { | 200 switch (block_state) { |
| 204 case ExternalProtocolHandler::DONT_BLOCK: | 201 case ExternalProtocolHandler::DONT_BLOCK: |
| 205 return URL; | 202 return URL; |
| 206 | 203 |
| 207 case ExternalProtocolHandler::BLOCK: | 204 case ExternalProtocolHandler::BLOCK: |
| 208 // If we don't want the user to open the URL, don't let it be navigated | 205 // If we don't want the user to open the URL, don't let it be navigated |
| 209 // to at all. | 206 // to at all. |
| 210 return QUERY; | 207 return QUERY; |
| 211 | 208 |
| 212 default: { | 209 default: { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 current_page_classification_ = AutocompleteInput::INVALID_SPEC; | 522 current_page_classification_ = AutocompleteInput::INVALID_SPEC; |
| 526 type_ = INVALID; | 523 type_ = INVALID; |
| 527 parts_ = url::Parsed(); | 524 parts_ = url::Parsed(); |
| 528 scheme_.clear(); | 525 scheme_.clear(); |
| 529 canonicalized_url_ = GURL(); | 526 canonicalized_url_ = GURL(); |
| 530 prevent_inline_autocomplete_ = false; | 527 prevent_inline_autocomplete_ = false; |
| 531 prefer_keyword_ = false; | 528 prefer_keyword_ = false; |
| 532 allow_exact_keyword_match_ = false; | 529 allow_exact_keyword_match_ = false; |
| 533 want_asynchronous_matches_ = true; | 530 want_asynchronous_matches_ = true; |
| 534 } | 531 } |
| OLD | NEW |