summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm2
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h6
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm28
-rw-r--r--chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h3
-rw-r--r--chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm10
-rw-r--r--chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration_unittest.mm3
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm3
-rw-r--r--chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm3
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc4
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc34
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.h10
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc2
-rw-r--r--chrome/browser/ui/toolbar/toolbar_model.cc8
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc32
-rw-r--r--chrome/browser/ui/views/frame/browser_root_view.cc2
-rw-r--r--chrome/browser/ui/views/location_bar/keyword_hint_view.cc4
-rw-r--r--chrome/browser/ui/views/location_bar/keyword_hint_view.h6
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc25
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h4
-rw-r--r--chrome/browser/ui/views/location_bar/selected_keyword_view.cc4
-rw-r--r--chrome/browser/ui/views/location_bar/selected_keyword_view.h6
21 files changed, 97 insertions, 102 deletions
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
index 0b8d2cc..1bc2eee 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
@@ -102,7 +102,7 @@ TEST_F(AutocompleteTextFieldCellTest, DISABLED_FocusedDisplay) {
SelectedKeywordDecoration selected_keyword_decoration([view_ font]);
selected_keyword_decoration.SetVisible(true);
- selected_keyword_decoration.SetKeyword(std::wstring(L"Google"), false);
+ selected_keyword_decoration.SetKeyword(ASCIIToUTF16("Google"), false);
[cell addLeftDecoration:&selected_keyword_decoration];
EXPECT_NE(selected_keyword_decoration.GetWidthForSpace(kVeryWide),
LocationBarDecoration::kOmittedWidth);
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
index 201b645..0f87f44 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -132,7 +132,7 @@ class LocationBarViewMac : public AutocompleteEditController,
virtual void OnAutocompleteWillClosePopup();
virtual void OnAutocompleteLosingFocus(gfx::NativeView unused);
virtual void OnAutocompleteWillAccept();
- virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
+ virtual bool OnCommitSuggestedText(const string16& typed_text);
virtual bool AcceptCurrentInstantPreview();
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
virtual void OnAutocompleteAccept(const GURL& url,
@@ -145,9 +145,9 @@ class LocationBarViewMac : public AutocompleteEditController,
virtual void OnKillFocus();
virtual void OnSetFocus();
virtual SkBitmap GetFavIcon() const;
- virtual std::wstring GetTitle() const;
+ virtual string16 GetTitle() const;
- NSImage* GetKeywordImage(const std::wstring& keyword);
+ NSImage* GetKeywordImage(const string16& keyword);
AutocompleteTextField* GetAutocompleteTextField() { return field_; }
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index f9071ab..213cc53 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -248,7 +248,7 @@ void LocationBarViewMac::OnAutocompleteWillAccept() {
update_instant_ = false;
}
-bool LocationBarViewMac::OnCommitSuggestedText(const std::wstring& typed_text) {
+bool LocationBarViewMac::OnCommitSuggestedText(const string16& typed_text) {
return edit_view_->CommitSuggestText();
}
@@ -317,17 +317,17 @@ void LocationBarViewMac::OnChanged() {
instant->Update
(browser_->GetSelectedTabContentsWrapper(),
edit_view_->model()->CurrentMatch(),
- WideToUTF16(edit_view_->GetText()),
+ edit_view_->GetText(),
edit_view_->model()->UseVerbatimInstant(),
&suggested_text);
if (!instant->MightSupportInstant()) {
- edit_view_->model()->FinalizeInstantQuery(std::wstring(),
- std::wstring());
+ edit_view_->model()->FinalizeInstantQuery(string16(),
+ string16());
}
} else {
instant->DestroyPreviewContents();
- edit_view_->model()->FinalizeInstantQuery(std::wstring(),
- std::wstring());
+ edit_view_->model()->FinalizeInstantQuery(string16(),
+ string16());
}
}
@@ -357,9 +357,9 @@ SkBitmap LocationBarViewMac::GetFavIcon() const {
return SkBitmap();
}
-std::wstring LocationBarViewMac::GetTitle() const {
+string16 LocationBarViewMac::GetTitle() const {
NOTIMPLEMENTED();
- return std::wstring();
+ return string16();
}
void LocationBarViewMac::Revert() {
@@ -520,10 +520,9 @@ NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const {
}
}
-NSImage* LocationBarViewMac::GetKeywordImage(const std::wstring& keyword) {
+NSImage* LocationBarViewMac::GetKeywordImage(const string16& keyword) {
const TemplateURL* template_url =
- profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(
- WideToUTF16Hack(keyword));
+ profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
if (template_url && template_url->IsExtensionKeyword()) {
const SkBitmap& bitmap = profile_->GetExtensionService()->
GetOmniboxIcon(template_url->GetExtensionId());
@@ -651,12 +650,12 @@ void LocationBarViewMac::Layout() {
keyword_hint_decoration_->SetVisible(false);
// Get the keyword to use for keyword-search and hinting.
- const std::wstring keyword(edit_view_->model()->keyword());
+ const string16 keyword = edit_view_->model()->keyword();
string16 short_name;
bool is_extension_keyword = false;
if (!keyword.empty()) {
short_name = profile_->GetTemplateURLModel()->
- GetKeywordShortName(WideToUTF16Hack(keyword), &is_extension_keyword);
+ GetKeywordShortName(keyword, &is_extension_keyword);
}
const bool is_keyword_hint = edit_view_->model()->is_keyword_hint();
@@ -665,8 +664,7 @@ void LocationBarViewMac::Layout() {
// Switch from location icon to keyword mode.
location_icon_decoration_->SetVisible(false);
selected_keyword_decoration_->SetVisible(true);
- selected_keyword_decoration_->SetKeyword(UTF16ToWideHack(short_name),
- is_extension_keyword);
+ selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword);
selected_keyword_decoration_->SetImage(GetKeywordImage(keyword));
} else if (toolbar_model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) {
// Switch from location icon to show the EV bubble instead.
diff --git a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h
index 3c9cf309..f64f354 100644
--- a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h
+++ b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h
@@ -10,6 +10,7 @@
#import <Cocoa/Cocoa.h>
+#include "base/string16.h"
#include "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h"
class SelectedKeywordDecoration : public BubbleDecoration {
@@ -18,7 +19,7 @@ class SelectedKeywordDecoration : public BubbleDecoration {
// Calculates appropriate full and partial label strings based on
// inputs.
- void SetKeyword(const std::wstring& keyword, bool is_extension_keyword);
+ void SetKeyword(const string16& keyword, bool is_extension_keyword);
// Determines what combination of labels and image will best fit
// within |width|, makes those current for |BubbleDecoration|, and
diff --git a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm
index fae0cc4..7d90eeb 100644
--- a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm
@@ -46,23 +46,23 @@ CGFloat SelectedKeywordDecoration::GetWidthForSpace(CGFloat width) {
return GetWidthForImageAndLabel(nil, partial_string_);
}
-void SelectedKeywordDecoration::SetKeyword(const std::wstring& short_name,
+void SelectedKeywordDecoration::SetKeyword(const string16& short_name,
bool is_extension_keyword) {
- const std::wstring min_name(
- location_bar_util::CalculateMinString(short_name));
+ const string16 min_name(WideToUTF16Hack(
+ location_bar_util::CalculateMinString(UTF16ToWideHack(short_name))));
const int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT;
// The text will be like "Search <name>:". "<name>" is a parameter
// derived from |short_name|.
full_string_.reset(
- [l10n_util::GetNSStringF(message_id, WideToUTF16(short_name)) copy]);
+ [l10n_util::GetNSStringF(message_id, short_name) copy]);
if (min_name.empty()) {
partial_string_.reset();
} else {
partial_string_.reset(
- [l10n_util::GetNSStringF(message_id, WideToUTF16(min_name)) copy]);
+ [l10n_util::GetNSStringF(message_id, min_name) copy]);
}
}
diff --git a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration_unittest.mm b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration_unittest.mm
index 5536fda..9112272 100644
--- a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration_unittest.mm
@@ -4,6 +4,7 @@
#import <Cocoa/Cocoa.h>
+#include "base/utf_string_conversions.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -32,7 +33,7 @@ class SelectedKeywordDecorationTest : public CocoaTest {
// not enough room.
TEST_F(SelectedKeywordDecorationTest, UsesPartialKeywordIfNarrow) {
- const std::wstring kKeyword(L"Engine");
+ const string16 kKeyword = ASCIIToUTF16("Engine");
NSString* const kFullString = @"Search Engine:";
NSString* const kPartialString = @"Search En\u2026:"; // ellipses
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index e141939..3c0775c 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -1753,8 +1753,7 @@ private:
// If the input is plain text, classify the input and make the URL.
AutocompleteMatch match;
browser_->profile()->GetAutocompleteClassifier()->Classify(
- base::SysNSStringToWide(text),
- std::wstring(), false, &match, NULL);
+ base::SysNSStringToUTF16(text), string16(), false, &match, NULL);
GURL url(match.destination_url);
[self openURL:&url inView:view at:point];
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
index 7a25aca..3f8f710 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -787,8 +787,7 @@ class NotificationBridge : public NotificationObserver {
// If the input is plain text, classify the input and make the URL.
AutocompleteMatch match;
browser_->profile()->GetAutocompleteClassifier()->Classify(
- base::SysNSStringToWide(text),
- std::wstring(), false, &match, NULL);
+ base::SysNSStringToUTF16(text), string16(), false, &match, NULL);
GURL url(match.destination_url);
browser_->GetSelectedTabContents()->OpenURL(url, GURL(), CURRENT_TAB,
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index dc86954..9ba091b 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -965,8 +965,8 @@ bool URLFromPrimarySelection(Profile* profile, GURL* url) {
// Use autocomplete to clean up the text, going so far as to turn it into
// a search query if necessary.
AutocompleteMatch match;
- profile->GetAutocompleteClassifier()->Classify(UTF8ToWide(selection_text),
- std::wstring(), false, &match, NULL);
+ profile->GetAutocompleteClassifier()->Classify(UTF8ToUTF16(selection_text),
+ string16(), false, &match, NULL);
g_free(selection_text);
if (!match.destination_url.is_valid())
return false;
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index 177d422..076b67e 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -459,7 +459,7 @@ void LocationBarViewGtk::OnAutocompleteWillAccept() {
}
bool LocationBarViewGtk::OnCommitSuggestedText(
- const std::wstring& typed_text) {
+ const string16& typed_text) {
return browser_->instant() && location_entry_->CommitInstantSuggestion();
}
@@ -513,7 +513,7 @@ void LocationBarViewGtk::OnAutocompleteAccept(const GURL& url,
void LocationBarViewGtk::OnChanged() {
UpdateSiteTypeArea();
- const std::wstring keyword(location_entry_->model()->keyword());
+ const string16 keyword(location_entry_->model()->keyword());
const bool is_keyword_hint = location_entry_->model()->is_keyword_hint();
show_selected_keyword_ = !keyword.empty() && !is_keyword_hint;
show_keyword_hint_ = !keyword.empty() && is_keyword_hint;
@@ -534,17 +534,17 @@ void LocationBarViewGtk::OnChanged() {
instant->Update(
browser_->GetSelectedTabContentsWrapper(),
location_entry_->model()->CurrentMatch(),
- WideToUTF16(location_entry_->GetText()),
+ location_entry_->GetText(),
location_entry_->model()->UseVerbatimInstant(),
&suggested_text);
if (!instant->MightSupportInstant()) {
- location_entry_->model()->FinalizeInstantQuery(std::wstring(),
- std::wstring());
+ location_entry_->model()->FinalizeInstantQuery(string16(),
+ string16());
}
} else {
instant->DestroyPreviewContents();
- location_entry_->model()->FinalizeInstantQuery(std::wstring(),
- std::wstring());
+ location_entry_->model()->FinalizeInstantQuery(string16(),
+ string16());
}
}
@@ -606,8 +606,8 @@ SkBitmap LocationBarViewGtk::GetFavIcon() const {
return GetTabContents()->GetFavIcon();
}
-std::wstring LocationBarViewGtk::GetTitle() const {
- return UTF16ToWideHack(GetTabContents()->GetTitle());
+string16 LocationBarViewGtk::GetTitle() const {
+ return GetTabContents()->GetTitle();
}
void LocationBarViewGtk::ShowFirstRunBubble(FirstRun::BubbleType bubble_type) {
@@ -627,8 +627,7 @@ void LocationBarViewGtk::SetSuggestedText(const string16& text) {
// text.
if (!text.empty()) {
location_entry_->model()->FinalizeInstantQuery(
- location_entry_->GetText(),
- UTF16ToWide(text));
+ location_entry_->GetText(), text);
}
} else {
location_entry_->SetInstantSuggestion(text);
@@ -971,7 +970,7 @@ void LocationBarViewGtk::UpdateEVCertificateLabelSize() {
pango_font_metrics_unref(metrics);
}
-void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) {
+void LocationBarViewGtk::SetKeywordLabel(const string16& keyword) {
if (keyword.empty())
return;
@@ -981,7 +980,7 @@ void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) {
bool is_extension_keyword;
const string16 short_name = profile_->GetTemplateURLModel()->
- GetKeywordShortName(WideToUTF16Hack(keyword), &is_extension_keyword);
+ GetKeywordShortName(keyword, &is_extension_keyword);
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT;
string16 full_name = l10n_util::GetStringFUTF16(message_id,
@@ -1000,8 +999,7 @@ void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) {
if (is_extension_keyword) {
const TemplateURL* template_url =
- profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(
- WideToUTF16Hack(keyword));
+ profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
const SkBitmap& bitmap = profile_->GetExtensionService()->
GetOmniboxIcon(template_url->GetExtensionId());
GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap);
@@ -1015,7 +1013,7 @@ void LocationBarViewGtk::SetKeywordLabel(const std::wstring& keyword) {
}
}
-void LocationBarViewGtk::SetKeywordHintLabel(const std::wstring& keyword) {
+void LocationBarViewGtk::SetKeywordHintLabel(const string16& keyword) {
if (keyword.empty())
return;
@@ -1025,7 +1023,7 @@ void LocationBarViewGtk::SetKeywordHintLabel(const std::wstring& keyword) {
bool is_extension_keyword;
const string16 short_name = profile_->GetTemplateURLModel()->
- GetKeywordShortName(WideToUTF16Hack(keyword), &is_extension_keyword);
+ GetKeywordShortName(keyword, &is_extension_keyword);
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
std::vector<size_t> content_param_offsets;
@@ -1129,7 +1127,7 @@ void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender,
if (!pixbuf)
return;
drag_icon_ = bookmark_utils::GetDragRepresentation(pixbuf,
- WideToUTF16(GetTitle()), theme_provider_);
+ GetTitle(), theme_provider_);
g_object_unref(pixbuf);
gtk_drag_set_icon_widget(context, drag_icon_, 0, 0);
}
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h
index 0298495..374d8fc 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h
@@ -95,7 +95,7 @@ class LocationBarViewGtk : public AutocompleteEditController,
virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus);
virtual void OnAutocompleteWillAccept();
// For this implementation, the parameter is ignored.
- virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
+ virtual bool OnCommitSuggestedText(const string16& typed_text);
virtual bool AcceptCurrentInstantPreview();
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
virtual void OnAutocompleteAccept(const GURL& url,
@@ -108,7 +108,7 @@ class LocationBarViewGtk : public AutocompleteEditController,
virtual void OnSetFocus();
virtual void OnInputInProgress(bool in_progress);
virtual SkBitmap GetFavIcon() const;
- virtual std::wstring GetTitle() const;
+ virtual string16 GetTitle() const;
// Implement the LocationBar interface.
virtual void ShowFirstRunBubble(FirstRun::BubbleType bubble_type);
@@ -313,10 +313,10 @@ class LocationBarViewGtk : public AutocompleteEditController,
void SetInfoText();
// Set the keyword text for the Search BLAH: keyword box.
- void SetKeywordLabel(const std::wstring& keyword);
+ void SetKeywordLabel(const string16& keyword);
// Set the keyword text for the "Press tab to search BLAH" hint box.
- void SetKeywordHintLabel(const std::wstring& keyword);
+ void SetKeywordHintLabel(const string16& keyword);
void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type);
@@ -423,7 +423,7 @@ class LocationBarViewGtk : public AutocompleteEditController,
bool show_keyword_hint_;
// The last search keyword that was shown via the |tab_to_search_box_|.
- std::wstring last_keyword_;
+ string16 last_keyword_;
// True if we should update the instant controller when the edit text changes.
bool update_instant_;
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index c79e8c1..cf6d3d4 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -1631,7 +1631,7 @@ bool TabStripGtk::CompleteDrop(guchar* data, bool is_plain_text) {
if (is_plain_text) {
AutocompleteMatch match;
model_->profile()->GetAutocompleteClassifier()->Classify(
- UTF8ToWide(reinterpret_cast<char*>(data)), std::wstring(), false,
+ UTF8ToUTF16(reinterpret_cast<char*>(data)), string16(), false,
&match, NULL);
url = match.destination_url;
} else {
diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc
index 98c392a..b8091a3 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model.cc
@@ -53,9 +53,11 @@ std::wstring ToolbarModel::GetText() const {
// Note that we can't unescape spaces here, because if the user copies this
// and pastes it into another program, that program may think the URL ends at
// the space.
- return AutocompleteInput::FormattedStringWithEquivalentMeaning(url,
- UTF16ToWideHack(net::FormatUrl(url, languages, net::kFormatUrlOmitAll,
- UnescapeRule::NORMAL, NULL, NULL, NULL)));
+ return UTF16ToWideHack(
+ AutocompleteInput::FormattedStringWithEquivalentMeaning(
+ url,
+ net::FormatUrl(url, languages, net::kFormatUrlOmitAll,
+ UnescapeRule::NORMAL, NULL, NULL, NULL)));
}
ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const {
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(
diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc
index 0350f19..0eb38e3 100644
--- a/chrome/browser/ui/views/frame/browser_root_view.cc
+++ b/chrome/browser/ui/views/frame/browser_root_view.cc
@@ -147,7 +147,7 @@ bool BrowserRootView::GetPasteAndGoURL(const ui::OSExchangeData& data,
AutocompleteMatch match;
browser_view_->browser()->profile()->GetAutocompleteClassifier()->Classify(
- text, std::wstring(), false, &match, NULL);
+ WideToUTF16Hack(text), string16(), false, &match, NULL);
if (!match.destination_url.is_valid())
return false;
diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
index 7e4ba37..07ca935 100644
--- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
+++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
@@ -48,7 +48,7 @@ void KeywordHintView::SetColor(const SkColor& color) {
trailing_label_->SetColor(color);
}
-void KeywordHintView::SetKeyword(const std::wstring& keyword) {
+void KeywordHintView::SetKeyword(const string16& keyword) {
keyword_ = keyword;
if (keyword_.empty())
return;
@@ -59,7 +59,7 @@ void KeywordHintView::SetKeyword(const std::wstring& keyword) {
std::vector<size_t> content_param_offsets;
bool is_extension_keyword;
string16 short_name = profile_->GetTemplateURLModel()->
- GetKeywordShortName(WideToUTF16Hack(keyword), &is_extension_keyword);
+ 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 =
diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.h b/chrome/browser/ui/views/location_bar/keyword_hint_view.h
index d7b23ec..0281231 100644
--- a/chrome/browser/ui/views/location_bar/keyword_hint_view.h
+++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.h
@@ -36,8 +36,8 @@ class KeywordHintView : public views::View {
void SetColor(const SkColor& color);
- void SetKeyword(const std::wstring& keyword);
- std::wstring keyword() const { return keyword_; }
+ void SetKeyword(const string16& keyword);
+ string16 keyword() const { return keyword_; }
virtual void Paint(gfx::Canvas* canvas);
virtual gfx::Size GetPreferredSize();
@@ -52,7 +52,7 @@ class KeywordHintView : public views::View {
views::Label* trailing_label_;
// The keyword.
- std::wstring keyword_;
+ string16 keyword_;
Profile* profile_;
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index fa6a63f..d66b51a 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -447,7 +447,7 @@ void LocationBarView::Layout() {
int ev_bubble_width = 0;
location_icon_view_->SetVisible(false);
ev_bubble_view_->SetVisible(false);
- const std::wstring keyword(location_entry_->model()->keyword());
+ const string16 keyword(location_entry_->model()->keyword());
const bool is_keyword_hint(location_entry_->model()->is_keyword_hint());
const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint;
if (show_selected_keyword) {
@@ -516,8 +516,7 @@ void LocationBarView::Layout() {
if (selected_keyword_view_->keyword() != keyword) {
selected_keyword_view_->SetKeyword(keyword);
const TemplateURL* template_url =
- profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(
- WideToUTF16Hack(keyword));
+ profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
if (template_url && template_url->IsExtensionKeyword()) {
const SkBitmap& bitmap = profile_->GetExtensionService()->
GetOmniboxIcon(template_url->GetExtensionId());
@@ -769,11 +768,11 @@ void LocationBarView::OnAutocompleteWillAccept() {
update_instant_ = false;
}
-bool LocationBarView::OnCommitSuggestedText(const std::wstring& typed_text) {
+bool LocationBarView::OnCommitSuggestedText(const string16& typed_text) {
InstantController* instant = delegate_->GetInstant();
if (!instant)
return false;
- std::wstring suggestion;
+ string16 suggestion;
#if defined(OS_WIN)
if (!HasValidSuggestText())
return false;
@@ -849,17 +848,17 @@ void LocationBarView::OnChanged() {
location_entry_->model()->popup_model()->IsOpen()) {
instant->Update(GetTabContentsWrapper(),
location_entry_->model()->CurrentMatch(),
- WideToUTF16(location_entry_->GetText()),
+ location_entry_->GetText(),
location_entry_->model()->UseVerbatimInstant(),
&suggested_text);
if (!instant->MightSupportInstant()) {
- location_entry_->model()->FinalizeInstantQuery(std::wstring(),
- std::wstring());
+ location_entry_->model()->FinalizeInstantQuery(string16(),
+ string16());
}
} else {
instant->DestroyPreviewContents();
- location_entry_->model()->FinalizeInstantQuery(std::wstring(),
- std::wstring());
+ location_entry_->model()->FinalizeInstantQuery(string16(),
+ string16());
}
}
@@ -895,8 +894,8 @@ SkBitmap LocationBarView::GetFavIcon() const {
return GetTabContentsFromDelegate(delegate_)->GetFavIcon();
}
-std::wstring LocationBarView::GetTitle() const {
- return UTF16ToWideHack(GetTabContentsFromDelegate(delegate_)->GetTitle());
+string16 LocationBarView::GetTitle() const {
+ return GetTabContentsFromDelegate(delegate_)->GetTitle();
}
int LocationBarView::AvailableWidth(int location_bar_width) {
@@ -1130,7 +1129,7 @@ void LocationBarView::SetSuggestedText(const string16& input) {
// text.
if (!input.empty()) {
location_entry_->model()->FinalizeInstantQuery(location_entry_->GetText(),
- UTF16ToWide(input));
+ input);
}
return;
}
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index f36c5c8..f96e463 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -195,7 +195,7 @@ class LocationBarView : public LocationBar,
virtual void OnAutocompleteWillClosePopup();
virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus);
virtual void OnAutocompleteWillAccept();
- virtual bool OnCommitSuggestedText(const std::wstring& typed_text);
+ virtual bool OnCommitSuggestedText(const string16& typed_text);
virtual bool AcceptCurrentInstantPreview();
virtual void OnPopupBoundsChanged(const gfx::Rect& bounds);
virtual void OnAutocompleteAccept(const GURL& url,
@@ -208,7 +208,7 @@ class LocationBarView : public LocationBar,
virtual void OnKillFocus();
virtual void OnSetFocus();
virtual SkBitmap GetFavIcon() const;
- virtual std::wstring GetTitle() const;
+ virtual string16 GetTitle() const;
// Overridden from views::View:
virtual std::string GetClassName() const;
diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
index 6f4b637..6af5000 100644
--- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
+++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
@@ -50,7 +50,7 @@ void SelectedKeywordView::Layout() {
IconLabelBubbleView::Layout();
}
-void SelectedKeywordView::SetKeyword(const std::wstring& keyword) {
+void SelectedKeywordView::SetKeyword(const string16& keyword) {
keyword_ = keyword;
if (keyword.empty())
return;
@@ -60,7 +60,7 @@ void SelectedKeywordView::SetKeyword(const std::wstring& keyword) {
bool is_extension_keyword;
const string16 short_name = profile_->GetTemplateURLModel()->
- GetKeywordShortName(WideToUTF16Hack(keyword), &is_extension_keyword);
+ GetKeywordShortName(keyword, &is_extension_keyword);
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT;
full_label_.SetText(UTF16ToWide(
diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.h b/chrome/browser/ui/views/location_bar/selected_keyword_view.h
index a3f8266..2e0c530 100644
--- a/chrome/browser/ui/views/location_bar/selected_keyword_view.h
+++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.h
@@ -33,8 +33,8 @@ class SelectedKeywordView : public IconLabelBubbleView {
virtual void Layout();
// The current keyword, or an empty string if no keyword is displayed.
- void SetKeyword(const std::wstring& keyword);
- std::wstring keyword() const { return keyword_; }
+ void SetKeyword(const string16& keyword);
+ string16 keyword() const { return keyword_; }
void set_profile(Profile* profile) { profile_ = profile; }
@@ -42,7 +42,7 @@ class SelectedKeywordView : public IconLabelBubbleView {
// The keyword we're showing. If empty, no keyword is selected.
// NOTE: we don't cache the TemplateURL as it is possible for it to get
// deleted out from under us.
- std::wstring keyword_;
+ string16 keyword_;
// These labels are never visible. They are used to size the view. One
// label contains the complete description of the keyword, the second