| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_autocomplete_scheme_classifier.h" | 5 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 8 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.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 27 matching lines...) Expand all Loading... |
| 38 return metrics::OmniboxInputType::URL; | 38 return metrics::OmniboxInputType::URL; |
| 39 | 39 |
| 40 // Not an internal protocol; check if it's an external protocol, i.e. one | 40 // Not an internal protocol; check if it's an external protocol, i.e. one |
| 41 // that's registered on the user's OS and will shell out to another program. | 41 // that's registered on the user's OS and will shell out to another program. |
| 42 // | 42 // |
| 43 // We need to do this after the checks above because some internally | 43 // We need to do this after the checks above because some internally |
| 44 // handlable schemes (e.g. "javascript") may be treated as "blocked" by the | 44 // handlable schemes (e.g. "javascript") may be treated as "blocked" by the |
| 45 // external protocol handler because we don't want pages to open them, but | 45 // external protocol handler because we don't want pages to open them, but |
| 46 // users still can. | 46 // users still can. |
| 47 const ExternalProtocolHandler::BlockState block_state = | 47 const ExternalProtocolHandler::BlockState block_state = |
| 48 ExternalProtocolHandler::GetBlockState(scheme); | 48 ExternalProtocolHandler::GetBlockState(scheme, profile_); |
| 49 switch (block_state) { | 49 switch (block_state) { |
| 50 case ExternalProtocolHandler::DONT_BLOCK: | 50 case ExternalProtocolHandler::DONT_BLOCK: |
| 51 return metrics::OmniboxInputType::URL; | 51 return metrics::OmniboxInputType::URL; |
| 52 | 52 |
| 53 case ExternalProtocolHandler::BLOCK: | 53 case ExternalProtocolHandler::BLOCK: |
| 54 // If we don't want the user to open the URL, don't let it be navigated | 54 // If we don't want the user to open the URL, don't let it be navigated |
| 55 // to at all. | 55 // to at all. |
| 56 return metrics::OmniboxInputType::QUERY; | 56 return metrics::OmniboxInputType::QUERY; |
| 57 | 57 |
| 58 default: | 58 default: |
| 59 return metrics::OmniboxInputType::INVALID; | 59 return metrics::OmniboxInputType::INVALID; |
| 60 } | 60 } |
| 61 } | 61 } |
| OLD | NEW |