summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/autocomplete
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-24 20:36:44 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-24 20:36:44 +0000
commit42ca28c9fb3d098729683f28085c9585af1c3df8 (patch)
treee9224ac8e93394601f7e863c3e8e75c8115e118d /chrome/browser/ui/views/autocomplete
parente94ccaeddbb8fb4cbc4e28d9e6f8df68ce48c37e (diff)
downloadchromium_src-42ca28c9fb3d098729683f28085c9585af1c3df8.zip
chromium_src-42ca28c9fb3d098729683f28085c9585af1c3df8.tar.gz
chromium_src-42ca28c9fb3d098729683f28085c9585af1c3df8.tar.bz2
Remove wstring from autocomplete.
BUG=23581 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6258015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/autocomplete')
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc32
1 files changed, 15 insertions, 17 deletions
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 1900df2..9068ace 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -108,7 +108,7 @@ SkColor GetColor(ResultViewState state, ColorKind kind) {
return colors[state][kind];
}
-const wchar_t kEllipsis[] = L"\x2026";
+const char16 kEllipsis[] = { 0x2026 };
const SkAlpha kGlassPopupAlpha = 240;
const SkAlpha kOpaquePopupAlpha = 255;
@@ -293,7 +293,7 @@ class AutocompleteResultView : public views::View {
// Precalculated data used to draw the portion of a match classification that
// fits entirely within one run.
struct ClassificationData {
- std::wstring text;
+ string16 text;
const gfx::Font* font;
SkColor color;
int pixel_width;
@@ -327,7 +327,7 @@ class AutocompleteResultView : public views::View {
// added to all of the classifications. Returns the x position to the right
// of the string.
int DrawString(gfx::Canvas* canvas,
- const std::wstring& text,
+ const string16& text,
const ACMatchClassifications& classifications,
bool force_dim,
int x,
@@ -422,7 +422,7 @@ AutocompleteResultView::AutocompleteResultView(
model_index_(model_index),
normal_font_(font),
bold_font_(bold_font),
- ellipsis_width_(font.GetStringWidth(WideToUTF16(kEllipsis))),
+ ellipsis_width_(font.GetStringWidth(string16(kEllipsis))),
mirroring_context_(new MirroringContext()),
match_(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED) {
CHECK(model_index >= 0);
@@ -458,8 +458,8 @@ void AutocompleteResultView::Paint(gfx::Canvas* canvas) {
// would also let us use a more properly-localizable string than we get with
// just the IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR.
if (!match_.description.empty()) {
- std::wstring separator = UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR));
+ string16 separator =
+ l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR);
ACMatchClassifications classifications;
classifications.push_back(
ACMatchClassification(0, ACMatchClassification::NONE));
@@ -534,7 +534,7 @@ const SkBitmap* AutocompleteResultView::GetIcon() const {
int AutocompleteResultView::DrawString(
gfx::Canvas* canvas,
- const std::wstring& text,
+ const string16& text,
const ACMatchClassifications& classifications,
bool force_dim,
int x,
@@ -558,7 +558,7 @@ int AutocompleteResultView::DrawString(
// unintended ways, e.g. by removing directional markings or by adding an
// ellipsis that's not enclosed in appropriate markings.
base::i18n::BiDiLineIterator bidi_line;
- if (!bidi_line.Open(WideToUTF16Hack(text), base::i18n::IsRTL(), is_url))
+ if (!bidi_line.Open(text, base::i18n::IsRTL(), is_url))
return x;
const int num_runs = bidi_line.CountRuns();
Runs runs;
@@ -613,8 +613,7 @@ int AutocompleteResultView::DrawString(
else
current_data->color = GetColor(state, force_dim ? DIMMED_TEXT : TEXT);
current_data->pixel_width =
- current_data->font->GetStringWidth(
- WideToUTF16Hack(current_data->text));
+ current_data->font->GetStringWidth(current_data->text);
current_run->pixel_width += current_data->pixel_width;
}
DCHECK(!current_run->classifications.empty());
@@ -670,7 +669,7 @@ int AutocompleteResultView::DrawString(
for (Classifications::const_iterator j(i->classifications.begin());
j != i->classifications.end(); ++j) {
int left = mirroring_context_->mirrored_left_coord(x, x + j->pixel_width);
- canvas->DrawStringInt(WideToUTF16Hack(j->text), *j->font, j->color, left,
+ canvas->DrawStringInt(j->text, *j->font, j->color, left,
y, j->pixel_width, j->font->GetHeight(), flags);
x += j->pixel_width;
}
@@ -709,9 +708,8 @@ void AutocompleteResultView::Elide(Runs* runs, int remaining_width) const {
first_classification = false;
// Can we fit at least an ellipsis?
- std::wstring elided_text(UTF16ToWideHack(
- ui::ElideText(WideToUTF16Hack(j->text), *j->font, remaining_width,
- false)));
+ string16 elided_text =
+ ui::ElideText(j->text, *j->font, remaining_width, false);
Classifications::reverse_iterator prior_classification(j);
++prior_classification;
const bool on_first_classification =
@@ -740,7 +738,7 @@ void AutocompleteResultView::Elide(Runs* runs, int remaining_width) const {
(prior_classification->font == &normal_font_)))
j->font = &normal_font_;
- j->pixel_width = j->font->GetStringWidth(WideToUTF16Hack(elided_text));
+ j->pixel_width = j->font->GetStringWidth(elided_text);
// Erase any other classifications that come after the elided one.
i->classifications.erase(j.base(), i->classifications.end());
@@ -1152,10 +1150,10 @@ void AutocompletePopupContentsView::OpenIndex(
// extension, |match| and its contents. So copy the relevant strings out to
// make sure they stay alive until the call completes.
const GURL url(match.destination_url);
- std::wstring keyword;
+ string16 keyword;
const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
edit_view_->OpenURL(url, disposition, match.transition, GURL(), index,
- is_keyword_hint ? std::wstring() : keyword);
+ is_keyword_hint ? string16() : keyword);
}
size_t AutocompletePopupContentsView::GetIndexForPoint(