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