Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc

Issue 426713002: Revert of Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
38 if (registry && registry->IsHandledProtocol(scheme)) 38 if (registry && registry->IsHandledProtocol(scheme))
39 return metrics::OmniboxInputType::URL; 39 return metrics::OmniboxInputType::URL;
40 40
41 // Not an internal protocol; check if it's an external protocol, i.e. one 41 // Not an internal protocol; check if it's an external protocol, i.e. one
42 // that's registered on the user's OS and will shell out to another program. 42 // that's registered on the user's OS and will shell out to another program.
43 // 43 //
44 // We need to do this after the checks above because some internally 44 // We need to do this after the checks above because some internally
45 // handlable schemes (e.g. "javascript") may be treated as "blocked" by the 45 // handlable schemes (e.g. "javascript") may be treated as "blocked" by the
46 // external protocol handler because we don't want pages to open them, but 46 // external protocol handler because we don't want pages to open them, but
47 // users still can. 47 // users still can.
48 //
49 // Note that the protocol handler needs to be informed that omnibox input
50 // should always be considered "user gesture-triggered", lest it always
51 // return BLOCK.
52 const ExternalProtocolHandler::BlockState block_state = 48 const ExternalProtocolHandler::BlockState block_state =
53 ExternalProtocolHandler::GetBlockState(scheme, true); 49 ExternalProtocolHandler::GetBlockState(scheme);
54 switch (block_state) { 50 switch (block_state) {
55 case ExternalProtocolHandler::DONT_BLOCK: 51 case ExternalProtocolHandler::DONT_BLOCK:
56 return metrics::OmniboxInputType::URL; 52 return metrics::OmniboxInputType::URL;
57 53
58 case ExternalProtocolHandler::BLOCK: 54 case ExternalProtocolHandler::BLOCK:
59 // If we don't want the user to open the URL, don't let it be navigated 55 // If we don't want the user to open the URL, don't let it be navigated
60 // to at all. 56 // to at all.
61 return metrics::OmniboxInputType::QUERY; 57 return metrics::OmniboxInputType::QUERY;
62 58
63 default: 59 default:
64 return metrics::OmniboxInputType::INVALID; 60 return metrics::OmniboxInputType::INVALID;
65 } 61 }
66 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698