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

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

Issue 5959008: Remove wstring from l10n_util. Part 2.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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
« no previous file with comments | « app/l10n_util_unittest.cc ('k') | chrome/browser/content_exceptions_table_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/autocomplete.h" 5 #include "chrome/browser/autocomplete/autocomplete.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/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 } 951 }
952 952
953 AutocompleteMatch match(NULL, 0, false, AutocompleteMatch::OPEN_HISTORY_PAGE); 953 AutocompleteMatch match(NULL, 0, false, AutocompleteMatch::OPEN_HISTORY_PAGE);
954 match.fill_into_edit = input_.text(); 954 match.fill_into_edit = input_.text();
955 955
956 // Mark up the text such that the user input text is bold. 956 // Mark up the text such that the user input text is bold.
957 size_t keyword_offset = std::wstring::npos; // Offset into match.contents. 957 size_t keyword_offset = std::wstring::npos; // Offset into match.contents.
958 if (history_contents_provider_->db_match_count() == 958 if (history_contents_provider_->db_match_count() ==
959 history_contents_provider_->kMaxMatchCount) { 959 history_contents_provider_->kMaxMatchCount) {
960 // History contents searcher has maxed out. 960 // History contents searcher has maxed out.
961 match.contents = l10n_util::GetStringF(IDS_OMNIBOX_RECENT_HISTORY_MANY, 961 match.contents = UTF16ToWideHack(
962 input_.text(), 962 l10n_util::GetStringFUTF16(IDS_OMNIBOX_RECENT_HISTORY_MANY,
963 &keyword_offset); 963 WideToUTF16Hack(input_.text()),
964 &keyword_offset));
964 } else { 965 } else {
965 // We can report exact matches when there aren't too many. 966 // We can report exact matches when there aren't too many.
966 std::vector<size_t> content_param_offsets; 967 std::vector<size_t> content_param_offsets;
967 match.contents = l10n_util::GetStringF( 968 match.contents = UTF16ToWideHack(l10n_util::GetStringFUTF16(
968 IDS_OMNIBOX_RECENT_HISTORY, 969 IDS_OMNIBOX_RECENT_HISTORY,
969 UTF16ToWide(base::FormatNumber(history_contents_provider_-> 970 base::FormatNumber(history_contents_provider_->
970 db_match_count())), 971 db_match_count()),
971 input_.text(), 972 WideToUTF16Hack(input_.text()),
972 &content_param_offsets); 973 &content_param_offsets));
973 974
974 // content_param_offsets is ordered based on supplied params, we expect 975 // content_param_offsets is ordered based on supplied params, we expect
975 // that the second one contains the query (first is the number). 976 // that the second one contains the query (first is the number).
976 if (content_param_offsets.size() == 2) { 977 if (content_param_offsets.size() == 2) {
977 keyword_offset = content_param_offsets[1]; 978 keyword_offset = content_param_offsets[1];
978 } else { 979 } else {
979 // See comments on an identical NOTREACHED() in search_provider.cc. 980 // See comments on an identical NOTREACHED() in search_provider.cc.
980 NOTREACHED(); 981 NOTREACHED();
981 } 982 }
982 } 983 }
(...skipping 20 matching lines...) Expand all
1003 void AutocompleteController::CheckIfDone() { 1004 void AutocompleteController::CheckIfDone() {
1004 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); 1005 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end();
1005 ++i) { 1006 ++i) {
1006 if (!(*i)->done()) { 1007 if (!(*i)->done()) {
1007 done_ = false; 1008 done_ = false;
1008 return; 1009 return;
1009 } 1010 }
1010 } 1011 }
1011 done_ = true; 1012 done_ = true;
1012 } 1013 }
OLDNEW
« no previous file with comments | « app/l10n_util_unittest.cc ('k') | chrome/browser/content_exceptions_table_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698