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

Unified Diff: chrome/browser/views/location_bar/keyword_hint_view.cc

Issue 2078021: First pass at experimental omnibox API. There are plenty of rough edges and (Closed)
Patch Set: no prefer_keyword Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/location_bar/keyword_hint_view.cc
diff --git a/chrome/browser/views/location_bar/keyword_hint_view.cc b/chrome/browser/views/location_bar/keyword_hint_view.cc
index 9f35e3be223f5965979ce544df58eb50d849d35c..14974c85114d85ffe2f87d682d384995fdb119c4 100644
--- a/chrome/browser/views/location_bar/keyword_hint_view.cc
+++ b/chrome/browser/views/location_bar/keyword_hint_view.cc
@@ -56,9 +56,13 @@ void KeywordHintView::SetKeyword(const std::wstring& keyword) {
return;
std::vector<size_t> content_param_offsets;
+ bool is_extension_keyword;
+ std::wstring short_name = profile_->GetTemplateURLModel()->
+ GetKeywordShortName(keyword, &is_extension_keyword);
+ int message_id = is_extension_keyword ?
+ IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
const std::wstring keyword_hint(l10n_util::GetStringF(
- IDS_OMNIBOX_KEYWORD_HINT, std::wstring(),
- GetKeywordName(profile_, keyword), &content_param_offsets));
+ message_id, std::wstring(), short_name, &content_param_offsets));
if (content_param_offsets.size() == 2) {
leading_label_->SetText(
keyword_hint.substr(0, content_param_offsets.front()));
@@ -121,17 +125,3 @@ void KeywordHintView::Layout() {
trailing_label_->SetBounds(x, 0, pref.width(), height());
}
}
-
-
-// static
-std::wstring KeywordHintView::GetKeywordName(Profile* profile,
- const std::wstring& keyword) {
- // Make sure the TemplateURL still exists.
- // TODO(sky): Once LocationBarView adds a listener to the TemplateURLModel
- // to track changes to the model, this should become a DCHECK.
- const TemplateURL* template_url =
- profile->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
- if (template_url)
- return template_url->AdjustedShortNameForLocaleDirection();
- return std::wstring();
-}
« no previous file with comments | « chrome/browser/views/location_bar/keyword_hint_view.h ('k') | chrome/browser/views/location_bar/selected_keyword_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698