Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm

Issue 8392017: Change string16 to std::string in the gfx::Font() interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add 'UTF-8' everywhere in the comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 targetPopupFrame_ = NSZeroRect; 446 targetPopupFrame_ = NSZeroRect;
447 447
448 return; 448 return;
449 } 449 }
450 450
451 CreatePopupIfNeeded(); 451 CreatePopupIfNeeded();
452 452
453 // The popup's font is a slightly smaller version of the field's. 453 // The popup's font is a slightly smaller version of the field's.
454 NSFont* fieldFont = OmniboxViewMac::GetFieldFont(); 454 NSFont* fieldFont = OmniboxViewMac::GetFieldFont();
455 const CGFloat resultFontSize = [fieldFont pointSize] + kEditFontAdjust; 455 const CGFloat resultFontSize = [fieldFont pointSize] + kEditFontAdjust;
456 gfx::Font resultFont(base::SysNSStringToUTF16([fieldFont fontName]), 456 gfx::Font resultFont(base::SysNSStringToUTF8([fieldFont fontName]),
457 static_cast<int>(resultFontSize)); 457 static_cast<int>(resultFontSize));
458 458
459 AutocompleteMatrix* matrix = GetAutocompleteMatrix(); 459 AutocompleteMatrix* matrix = GetAutocompleteMatrix();
460 460
461 // Calculate the width of the matrix based on backing out the 461 // Calculate the width of the matrix based on backing out the
462 // popup's border from the width of the field. Would prefer to use 462 // popup's border from the width of the field. Would prefer to use
463 // [matrix convertSize:fromView:] for converting from screen size, 463 // [matrix convertSize:fromView:] for converting from screen size,
464 // but that doesn't work until the popup is on-screen (bug?). 464 // but that doesn't work until the popup is on-screen (bug?).
465 const NSRect fieldRectBase = [field_ convertRect:[field_ bounds] toView:nil]; 465 const NSRect fieldRectBase = [field_ convertRect:[field_ bounds] toView:nil];
466 const CGFloat popupWidth = NSWidth(fieldRectBase) - 2 * kWindowBorderWidth; 466 const CGFloat popupWidth = NSWidth(fieldRectBase) - 2 * kWindowBorderWidth;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 bottomLeftCornerRadius:kPopupRoundingRadius 824 bottomLeftCornerRadius:kPopupRoundingRadius
825 bottomRightCornerRadius:kPopupRoundingRadius]; 825 bottomRightCornerRadius:kPopupRoundingRadius];
826 826
827 // Draw the matrix clipped to our border. 827 // Draw the matrix clipped to our border.
828 gfx::ScopedNSGraphicsContextSaveGState scopedGState; 828 gfx::ScopedNSGraphicsContextSaveGState scopedGState;
829 [path addClip]; 829 [path addClip];
830 [super drawRect:rect]; 830 [super drawRect:rect];
831 } 831 }
832 832
833 @end 833 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698