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

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

Issue 131783012: Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: kalman comment Created 6 years, 8 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 (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
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 // External protocol handler checks for the existence of a user gesture.
202 // Fake one so that we don't always get a BLOCK result.
Peter Kasting 2014/03/28 22:56:37 Nit: How about this comment, appended at the end o
meacer 2014/03/28 23:13:57 Done.
203 ExternalProtocolHandler::ScopedUserGesture skip_user_gesture_check;
201 ExternalProtocolHandler::BlockState block_state = 204 ExternalProtocolHandler::BlockState block_state =
202 ExternalProtocolHandler::GetBlockState( 205 ExternalProtocolHandler::GetBlockState(
203 base::UTF16ToUTF8(parsed_scheme)); 206 base::UTF16ToUTF8(parsed_scheme));
204 switch (block_state) { 207 switch (block_state) {
205 case ExternalProtocolHandler::DONT_BLOCK: 208 case ExternalProtocolHandler::DONT_BLOCK:
206 return return_value_for_non_http_url; 209 return return_value_for_non_http_url;
207 210
208 case ExternalProtocolHandler::BLOCK: 211 case ExternalProtocolHandler::BLOCK:
209 // If we don't want the user to open the URL, don't let it be navigated 212 // If we don't want the user to open the URL, don't let it be navigated
210 // to at all. 213 // to at all.
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 current_page_classification_ = AutocompleteInput::INVALID_SPEC; 533 current_page_classification_ = AutocompleteInput::INVALID_SPEC;
531 type_ = INVALID; 534 type_ = INVALID;
532 parts_ = url_parse::Parsed(); 535 parts_ = url_parse::Parsed();
533 scheme_.clear(); 536 scheme_.clear();
534 canonicalized_url_ = GURL(); 537 canonicalized_url_ = GURL();
535 prevent_inline_autocomplete_ = false; 538 prevent_inline_autocomplete_ = false;
536 prefer_keyword_ = false; 539 prefer_keyword_ = false;
537 allow_exact_keyword_match_ = false; 540 allow_exact_keyword_match_ = false;
538 matches_requested_ = ALL_MATCHES; 541 matches_requested_ = ALL_MATCHES;
539 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698