summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-31 20:30:28 +0100
committerKristian Monsen <kristianm@google.com>2011-06-14 20:31:41 -0700
commit72a454cd3513ac24fbdd0e0cb9ad70b86a99b801 (patch)
tree382278a54ce7a744d62fa510a9a80688cc12434b /chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
parentc4becdd46e31d261b930e4b5a539cbc1d45c23a6 (diff)
downloadexternal_chromium-72a454cd3513ac24fbdd0e0cb9ad70b86a99b801.zip
external_chromium-72a454cd3513ac24fbdd0e0cb9ad70b86a99b801.tar.gz
external_chromium-72a454cd3513ac24fbdd0e0cb9ad70b86a99b801.tar.bz2
Merge Chromium.org at r11.0.672.0: Initial merge by git.
Change-Id: I8b4aaf611a2a405fe3fe10e8a94ea7658645c192
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_view_mac.mm')
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm25
1 files changed, 12 insertions, 13 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index d0b84e7..00c31c3 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -6,8 +6,6 @@
#include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h"
-#include "app/resource_bundle.h"
-#include "app/text_elider.h"
#include "base/stl_util-inl.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
@@ -23,11 +21,13 @@
#import "chrome/browser/ui/cocoa/location_bar/instant_opt_in_controller.h"
#import "chrome/browser/ui/cocoa/location_bar/instant_opt_in_view.h"
#import "chrome/browser/ui/cocoa/location_bar/omnibox_popup_view.h"
-#include "gfx/rect.h"
#include "grit/theme_resources.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
#import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/text/text_elider.h"
+#include "ui/gfx/rect.h"
namespace {
@@ -102,14 +102,14 @@ static NSColor* URLTextColor() {
// and description cases. Returns NSMutableAttributedString as a
// convenience for MatchText().
NSMutableAttributedString* AutocompletePopupViewMac::DecorateMatchedString(
- const std::wstring &matchString,
+ const string16 &matchString,
const AutocompleteMatch::ACMatchClassifications &classifications,
NSColor* textColor, NSColor* dimTextColor, gfx::Font& font) {
// Cache for on-demand computation of the bold version of |font|.
NSFont* boldFont = nil;
// Start out with a string using the default style info.
- NSString* s = base::SysWideToNSString(matchString);
+ NSString* s = base::SysUTF16ToNSString(matchString);
NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
font.GetNativeFont(), NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
@@ -154,7 +154,7 @@ NSMutableAttributedString* AutocompletePopupViewMac::DecorateMatchedString(
NSMutableAttributedString* AutocompletePopupViewMac::ElideString(
NSMutableAttributedString* aString,
- const std::wstring originalString,
+ const string16 originalString,
const gfx::Font& font,
const float width) {
// If it already fits, nothing to be done.
@@ -163,8 +163,7 @@ NSMutableAttributedString* AutocompletePopupViewMac::ElideString(
}
// If ElideText() decides to do nothing, nothing to be done.
- const std::wstring elided(UTF16ToWideHack(ElideText(
- WideToUTF16Hack(originalString), font, width, false)));
+ const string16 elided = ui::ElideText(originalString, font, width, false);
if (0 == elided.compare(originalString)) {
return aString;
}
@@ -181,7 +180,7 @@ NSMutableAttributedString* AutocompletePopupViewMac::ElideString(
DCHECK(0 != elided.compare(0, i, originalString));
// Replace the end of |aString| with the ellipses from |elided|.
- NSString* s = base::SysWideToNSString(elided.substr(i));
+ NSString* s = base::SysUTF16ToNSString(elided.substr(i));
[aString replaceCharactersInRange:NSMakeRange(i, [aString length] - i)
withString:s];
@@ -449,7 +448,7 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
// The popup's font is a slightly smaller version of the field's.
NSFont* fieldFont = AutocompleteEditViewMac::GetFieldFont();
const CGFloat resultFontSize = [fieldFont pointSize] + kEditFontAdjust;
- gfx::Font resultFont(base::SysNSStringToWide([fieldFont fontName]),
+ gfx::Font resultFont(base::SysNSStringToUTF16([fieldFont fontName]),
static_cast<int>(resultFontSize));
AutocompleteMatrix* matrix = GetAutocompleteMatrix();
@@ -519,7 +518,7 @@ gfx::Rect AutocompletePopupViewMac::GetTargetBounds() {
}
void AutocompletePopupViewMac::SetSelectedLine(size_t line) {
- model_->SetSelectedLine(line, false);
+ model_->SetSelectedLine(line, false, false);
}
// This is only called by model in SetSelectedLine() after updating
@@ -548,10 +547,10 @@ void AutocompletePopupViewMac::OpenURLForRow(int row, bool force_background) {
// completes.
const AutocompleteMatch& match = model_->result().match_at(row);
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(), row,
- is_keyword_hint ? std::wstring() : keyword);
+ is_keyword_hint ? string16() : keyword);
}
void AutocompletePopupViewMac::UserPressedOptIn(bool opt_in) {