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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: possible fix for mac code (cannot compile mac code myself) Created 5 years, 6 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/omnibox/omnibox_edit_model.h" 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "chrome/app/chrome_command_ids.h" 19 #include "chrome/app/chrome_command_ids.h"
20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
21 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 21 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
22 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
22 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 23 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
24 #include "chrome/browser/bookmarks/bookmark_stats.h" 25 #include "chrome/browser/bookmarks/bookmark_stats.h"
25 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/command_updater.h" 27 #include "chrome/browser/command_updater.h"
27 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" 28 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
28 #include "chrome/browser/net/predictor.h" 29 #include "chrome/browser/net/predictor.h"
29 #include "chrome/browser/predictors/autocomplete_action_predictor.h" 30 #include "chrome/browser/predictors/autocomplete_action_predictor.h"
30 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" 31 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
31 #include "chrome/browser/prerender/prerender_field_trial.h" 32 #include "chrome/browser/prerender/prerender_field_trial.h"
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 base::TimeDelta::FromMilliseconds(-1); 778 base::TimeDelta::FromMilliseconds(-1);
778 elapsed_time_since_user_first_modified_omnibox = default_time_delta; 779 elapsed_time_since_user_first_modified_omnibox = default_time_delta;
779 elapsed_time_since_last_change_to_default_match = default_time_delta; 780 elapsed_time_since_last_change_to_default_match = default_time_delta;
780 } 781 }
781 // If the popup is closed or this is a paste-and-go action (meaning the 782 // If the popup is closed or this is a paste-and-go action (meaning the
782 // contents of the dropdown are ignored regardless), we record for logging 783 // contents of the dropdown are ignored regardless), we record for logging
783 // purposes a selected_index of 0 and a suggestion list as having a single 784 // purposes a selected_index of 0 and a suggestion list as having a single
784 // entry of the match used. 785 // entry of the match used.
785 ACMatches fake_single_entry_matches; 786 ACMatches fake_single_entry_matches;
786 fake_single_entry_matches.push_back(match); 787 fake_single_entry_matches.push_back(match);
787 AutocompleteResult fake_single_entry_result; 788 AutocompleteResult fake_single_entry_result(
789 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile_)).get());
Peter Kasting 2015/06/29 05:04:59 This seems kind of scary. I think the scope of th
Mark P 2015/06/30 04:23:17 That's a good alternate design. I thought of one
788 fake_single_entry_result.AppendMatches(input_, fake_single_entry_matches); 790 fake_single_entry_result.AppendMatches(input_, fake_single_entry_matches);
789 OmniboxLog log( 791 OmniboxLog log(
790 input_text, 792 input_text,
791 just_deleted_text_, 793 just_deleted_text_,
792 input_.type(), 794 input_.type(),
793 popup_model()->IsOpen(), 795 popup_model()->IsOpen(),
794 (!popup_model()->IsOpen() || !pasted_text.empty()) ? 0 : index, 796 (!popup_model()->IsOpen() || !pasted_text.empty()) ? 0 : index,
795 !pasted_text.empty(), 797 !pasted_text.empty(),
796 -1, // don't yet know tab ID; set later if appropriate 798 -1, // don't yet know tab ID; set later if appropriate
797 ClassifyPage(), 799 ClassifyPage(),
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 // Update state and notify view if the omnibox has focus and the caret 1539 // Update state and notify view if the omnibox has focus and the caret
1538 // visibility changed. 1540 // visibility changed.
1539 const bool was_caret_visible = is_caret_visible(); 1541 const bool was_caret_visible = is_caret_visible();
1540 focus_state_ = state; 1542 focus_state_ = state;
1541 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1543 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1542 is_caret_visible() != was_caret_visible) 1544 is_caret_visible() != was_caret_visible)
1543 view_->ApplyCaretVisibility(); 1545 view_->ApplyCaretVisibility();
1544 1546
1545 delegate_->OnFocusChanged(focus_state_, reason); 1547 delegate_->OnFocusChanged(focus_state_, reason);
1546 } 1548 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698