diff options
author | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 17:27:47 +0000 |
---|---|---|
committer | xji@chromium.org <xji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 17:27:47 +0000 |
commit | bed9bd6cf3f489a1abf040accca3011b170cb471 (patch) | |
tree | 771a58a4ebbd5df8b5a6984ce066f79f0412a648 /chrome | |
parent | 6c2779d1e0fa36723ac97647fce6f3dd013c6c24 (diff) | |
download | chromium_src-bed9bd6cf3f489a1abf040accca3011b170cb471.zip chromium_src-bed9bd6cf3f489a1abf040accca3011b170cb471.tar.gz chromium_src-bed9bd6cf3f489a1abf040accca3011b170cb471.tar.bz2 |
This CL fix issue 2674 - search engine name containing parenthesis is not displayed correctly in Omnibox
NavSuggest drop-down list.
The fix is to adjust the search engine name according to locale direction so that the search engine name containing parenthesis are marked with RLE-PDF to be displayed correctly in RTL UI.
BUG=2674
Review URL: http://codereview.chromium.org/79005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autocomplete/keyword_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 5 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url.cc | 8 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 9 |
5 files changed, 16 insertions, 10 deletions
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc index 67f4edd..b546c92 100644 --- a/chrome/browser/autocomplete/keyword_provider.cc +++ b/chrome/browser/autocomplete/keyword_provider.cc @@ -193,7 +193,7 @@ void KeywordProvider::FillInURLAndContents( if (element->url()->SupportsReplacement()) { // No query input; return a generic, no-destination placeholder. match->contents.assign(l10n_util::GetStringF(IDS_KEYWORD_SEARCH, - element->short_name(), + element->AdjustedShortNameForLocaleDirection(), l10n_util::GetString(IDS_EMPTY_KEYWORD_VALUE))); match->contents_class.push_back( ACMatchClassification(0, ACMatchClassification::DIM)); diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 1c1dccdf..1099efc 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -90,7 +90,8 @@ void SearchProvider::Start(const AutocompleteInput& input, static const std::wstring kNoQueryInput( l10n_util::GetString(IDS_AUTOCOMPLETE_NO_QUERY)); match.contents.assign(l10n_util::GetStringF( - IDS_AUTOCOMPLETE_SEARCH_CONTENTS, default_provider->short_name(), + IDS_AUTOCOMPLETE_SEARCH_CONTENTS, + default_provider->AdjustedShortNameForLocaleDirection(), kNoQueryInput)); match.contents_class.push_back( ACMatchClassification(0, ACMatchClassification::DIM)); @@ -327,7 +328,7 @@ void SearchProvider::OnGotMostRecentKeywordSearchTerms( profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); DCHECK(history_service); if (providers_.valid_keyword_provider() && - (providers_.keyword_provider().id() == + (providers_.keyword_provider().id() == history_request_consumer_.GetClientData(history_service, handle))) { keyword_history_results_ = *results; } else { diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index 72ffc6d..b73bdd0 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -496,6 +496,14 @@ bool TemplateURL::SupportsReplacement(const TemplateURL* turl) { return turl && turl->url() && turl->url()->SupportsReplacement(); } +std::wstring TemplateURL::AdjustedShortNameForLocaleDirection() const { + std::wstring bidi_safe_short_name; + if (l10n_util::AdjustStringForLocaleDirection(short_name_, + &bidi_safe_short_name)) + return bidi_safe_short_name; + return short_name_; +} + void TemplateURL::SetSuggestionsURL(const std::wstring& suggestions_url, int index_offset, int page_offset) { diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h index 983621a..e6f2b65 100644 --- a/chrome/browser/search_engines/template_url.h +++ b/chrome/browser/search_engines/template_url.h @@ -272,6 +272,8 @@ class TemplateURL { } const std::wstring& short_name() const { return short_name_; } + std::wstring AdjustedShortNameForLocaleDirection() const; + // A description of the template; this may be empty. void set_description(const std::wstring& description) { description_ = description; diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 59bce3b..19db7b2 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -66,13 +66,8 @@ static std::wstring GetKeywordDescription(Profile* profile, // to track changes to the model, this should become a DCHECK. const TemplateURL* template_url = profile->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); - if (template_url) { - std::wstring keyword_description; - if (l10n_util::AdjustStringForLocaleDirection(template_url->short_name(), - &keyword_description)) - return keyword_description; - return template_url->short_name(); - } + if (template_url) + return template_url->AdjustedShortNameForLocaleDirection(); return std::wstring(); } |