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

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

Issue 1513023: Strips http from omnibox (and a couple of other places) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 730
731 AutocompleteMatch SearchProvider::NavigationToMatch( 731 AutocompleteMatch SearchProvider::NavigationToMatch(
732 const NavigationResult& navigation, 732 const NavigationResult& navigation,
733 int relevance, 733 int relevance,
734 bool is_keyword) { 734 bool is_keyword) {
735 const std::wstring& input_text = 735 const std::wstring& input_text =
736 is_keyword ? keyword_input_text_ : input_.text(); 736 is_keyword ? keyword_input_text_ : input_.text();
737 AutocompleteMatch match(this, relevance, false, 737 AutocompleteMatch match(this, relevance, false,
738 AutocompleteMatch::NAVSUGGEST); 738 AutocompleteMatch::NAVSUGGEST);
739 match.destination_url = navigation.url; 739 match.destination_url = navigation.url;
740 match.contents = StringForURLDisplay(navigation.url, true); 740 const bool trim_http = !url_util::FindAndCompareScheme(
741 if (!url_util::FindAndCompareScheme(WideToUTF8(input_text), 741 WideToUTF8(input_text), chrome::kHttpScheme, NULL);
742 chrome::kHttpScheme, NULL)) 742 match.contents = StringForURLDisplay(navigation.url, true, trim_http);
743 TrimHttpPrefix(&match.contents);
744 AutocompleteMatch::ClassifyMatchInString(input_text, match.contents, 743 AutocompleteMatch::ClassifyMatchInString(input_text, match.contents,
745 ACMatchClassification::URL, 744 ACMatchClassification::URL,
746 &match.contents_class); 745 &match.contents_class);
747 746
748 match.description = navigation.site_name; 747 match.description = navigation.site_name;
749 AutocompleteMatch::ClassifyMatchInString(input_text, navigation.site_name, 748 AutocompleteMatch::ClassifyMatchInString(input_text, navigation.site_name,
750 ACMatchClassification::NONE, 749 ACMatchClassification::NONE,
751 &match.description_class); 750 &match.description_class);
752 751
753 // When the user forced a query, we need to make sure all the fill_into_edit 752 // When the user forced a query, we need to make sure all the fill_into_edit
754 // values preserve that property. Otherwise, if the user starts editing a 753 // values preserve that property. Otherwise, if the user starts editing a
755 // suggestion, non-Search results will suddenly appear. 754 // suggestion, non-Search results will suddenly appear.
756 if (input_.type() == AutocompleteInput::FORCED_QUERY) 755 if (input_.type() == AutocompleteInput::FORCED_QUERY)
757 match.fill_into_edit.assign(L"?"); 756 match.fill_into_edit.assign(L"?");
758 match.fill_into_edit.append(match.contents); 757 match.fill_into_edit.append(match.contents);
759 // TODO(pkasting): http://b/1112879 These should perhaps be 758 // TODO(pkasting): http://b/1112879 These should perhaps be
760 // inline-autocompletable? 759 // inline-autocompletable?
761 760
762 return match; 761 return match;
763 } 762 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/bookmarks/bookmark_table_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698