diff options
Diffstat (limited to 'chrome/browser/ui/cocoa')
6 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/ui/cocoa/download/download_item_cell.mm b/chrome/browser/ui/cocoa/download/download_item_cell.mm index b83d6f5..d2a8335 100644 --- a/chrome/browser/ui/cocoa/download/download_item_cell.mm +++ b/chrome/browser/ui/cocoa/download/download_item_cell.mm @@ -237,14 +237,14 @@ NSGradient* BackgroundTheme::GetNSGradient(int id) const { // Set the name of the download. downloadPath_ = downloadModel->download()->GetFileNameToReportUser(); - std::wstring statusText = downloadModel->GetStatusText(); + string16 statusText = downloadModel->GetStatusText(); if (statusText.empty()) { // Remove the status text label. [self hideSecondaryTitle]; isStatusTextVisible_ = NO; } else { // Set status text. - NSString* statusString = base::SysWideToNSString(statusText); + NSString* statusString = base::SysUTF16ToNSString(statusText); [self setSecondaryTitle:statusString]; isStatusTextVisible_ = YES; } 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 1598cad..845835a 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 @@ -6,6 +6,7 @@ #include "app/resource_bundle.h" #include "base/scoped_nsobject.h" +#include "base/utf_string_conversions.h" #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" @@ -133,7 +134,7 @@ TEST_F(AutocompleteTextFieldCellTest, DISABLED_FocusedDisplay) { KeywordHintDecoration keyword_hint_decoration([view_ font]); keyword_hint_decoration.SetVisible(true); - keyword_hint_decoration.SetKeyword(std::wstring(L"google"), false); + keyword_hint_decoration.SetKeyword(ASCIIToUTF16("google"), false); [cell addRightDecoration:&keyword_hint_decoration]; EXPECT_NE(keyword_hint_decoration.GetWidthForSpace(kVeryWide), LocationBarDecoration::kOmittedWidth); diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h index 3b8c607..da8c42b 100644 --- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h +++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h @@ -11,6 +11,7 @@ #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" #import "base/scoped_nsobject.h" +#include "base/string16.h" // Draws the keyword hint, "Press [tab] to search <site>". @@ -21,7 +22,7 @@ class KeywordHintDecoration : public LocationBarDecoration { // Calculates the message to display and where to place the [tab] // image. - void SetKeyword(const std::wstring& keyword, bool is_extension_keyword); + void SetKeyword(const string16& keyword, bool is_extension_keyword); // Implement |LocationBarDecoration|. virtual void DrawInFrame(NSRect frame, NSView* control_view); diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm index 0b080319..767092b 100644 --- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm @@ -34,10 +34,10 @@ const CGFloat kHintAvailableRatio = 2.0 / 3.0; // Helper to convert |s| to an |NSString|, trimming whitespace at // ends. -NSString* TrimAndConvert(const std::wstring& s) { - std::wstring output; +NSString* TrimAndConvert(const string16& s) { + string16 output; TrimWhitespace(s, TRIM_ALL, &output); - return base::SysWideToNSString(output); + return base::SysUTF16ToNSString(output); } } // namespace @@ -65,7 +65,7 @@ NSImage* KeywordHintDecoration::GetHintImage() { return hint_image_; } -void KeywordHintDecoration::SetKeyword(const std::wstring& short_name, +void KeywordHintDecoration::SetKeyword(const string16& short_name, bool is_extension_keyword) { // KEYWORD_HINT is a message like "Press [tab] to search <site>". // [tab] is a parameter to be replaced by an image. "<site>" is @@ -73,10 +73,10 @@ void KeywordHintDecoration::SetKeyword(const std::wstring& short_name, std::vector<size_t> content_param_offsets; int message_id = is_extension_keyword ? IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT; - const std::wstring keyword_hint( - l10n_util::GetStringF(message_id, - std::wstring(), short_name, - &content_param_offsets)); + const string16 keyword_hint( + l10n_util::GetStringFUTF16(message_id, + string16(), short_name, + &content_param_offsets)); // Should always be 2 offsets, see the comment in // location_bar_view.cc after IDS_OMNIBOX_KEYWORD_HINT fetch. diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm index bfcf454..12ac5d8 100644 --- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm +++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm @@ -6,6 +6,7 @@ #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" +#include "base/utf_string_conversions.h" #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,7 +23,7 @@ class KeywordHintDecorationTest : public CocoaTest { TEST_F(KeywordHintDecorationTest, GetWidthForSpace) { decoration_.SetVisible(true); - decoration_.SetKeyword(std::wstring(L"Google"), false); + decoration_.SetKeyword(ASCIIToUTF16("google"), false); const CGFloat kVeryWide = 1000.0; const CGFloat kFairlyWide = 100.0; // Estimate for full hint space. 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 d433822..32002e6 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 @@ -680,7 +680,8 @@ void LocationBarViewMac::Layout() { std::wstring label(toolbar_model_->GetEVCertName()); ev_bubble_decoration_->SetFullLabel(base::SysWideToNSString(label)); } else if (!keyword.empty() && is_keyword_hint) { - keyword_hint_decoration_->SetKeyword(short_name, is_extension_keyword); + keyword_hint_decoration_->SetKeyword(WideToUTF16Hack(short_name), + is_extension_keyword); keyword_hint_decoration_->SetVisible(true); } |