OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return skia::SkColorToCalibratedNSColor(SkColorSetRGB(0x0b, 0x80, 0x43)); | 68 return skia::SkColorToCalibratedNSColor(SkColorSetRGB(0x0b, 0x80, 0x43)); |
69 } | 69 } |
70 NSColor* NegativeTextColor() { | 70 NSColor* NegativeTextColor() { |
71 return skia::SkColorToCalibratedNSColor(SkColorSetRGB(0xc5, 0x39, 0x29)); | 71 return skia::SkColorToCalibratedNSColor(SkColorSetRGB(0xc5, 0x39, 0x29)); |
72 } | 72 } |
73 NSColor* URLTextColor() { | 73 NSColor* URLTextColor() { |
74 return [NSColor colorWithCalibratedRed:0.0 green:0.55 blue:0.0 alpha:1.0]; | 74 return [NSColor colorWithCalibratedRed:0.0 green:0.55 blue:0.0 alpha:1.0]; |
75 } | 75 } |
76 | 76 |
77 NSFont* FieldFont() { | 77 NSFont* FieldFont() { |
78 return OmniboxViewMac::GetFieldFont(gfx::Font::NORMAL); | 78 return OmniboxViewMac::GetNormalFieldFont(); |
79 } | 79 } |
80 NSFont* BoldFieldFont() { | 80 NSFont* BoldFieldFont() { |
81 return OmniboxViewMac::GetFieldFont(gfx::Font::BOLD); | 81 return OmniboxViewMac::GetBoldFieldFont(); |
82 } | 82 } |
83 NSFont* LargeFont() { | 83 NSFont* LargeFont() { |
84 return OmniboxViewMac::GetLargeFont(gfx::Font::NORMAL); | 84 return OmniboxViewMac::GetLargeFont(); |
85 } | 85 } |
86 NSFont* LargeSuperscriptFont() { | 86 NSFont* LargeSuperscriptFont() { |
87 NSFont* font = OmniboxViewMac::GetLargeFont(gfx::Font::NORMAL); | 87 NSFont* font = OmniboxViewMac::GetLargeFont(); |
88 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. | 88 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. |
89 // Proportions from 5/9 to 5/7 all look pretty good. | 89 // Proportions from 5/9 to 5/7 all look pretty good. |
90 CGFloat size = [font pointSize] * 5.0 / 9.0; | 90 CGFloat size = [font pointSize] * 5.0 / 9.0; |
91 NSFontDescriptor* descriptor = [font fontDescriptor]; | 91 NSFontDescriptor* descriptor = [font fontDescriptor]; |
92 return [NSFont fontWithDescriptor:descriptor size:size]; | 92 return [NSFont fontWithDescriptor:descriptor size:size]; |
93 } | 93 } |
94 NSFont* SmallFont() { | 94 NSFont* SmallFont() { |
95 return OmniboxViewMac::GetSmallFont(gfx::Font::NORMAL); | 95 return OmniboxViewMac::GetSmallFont(); |
96 } | 96 } |
97 | 97 |
98 CGFloat GetContentAreaWidth(NSRect cellFrame) { | 98 CGFloat GetContentAreaWidth(NSRect cellFrame) { |
99 return NSWidth(cellFrame) - kTextStartOffset; | 99 return NSWidth(cellFrame) - kTextStartOffset; |
100 } | 100 } |
101 | 101 |
102 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, | 102 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, |
103 NSInteger style_type, | 103 NSInteger style_type, |
104 bool is_bold) { | 104 bool is_bold) { |
105 NSDictionary* answer_style = nil; | 105 NSDictionary* answer_style = nil; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; | 627 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; |
628 } | 628 } |
629 | 629 |
630 + (NSAttributedString*)createSeparatorString { | 630 + (NSAttributedString*)createSeparatorString { |
631 base::string16 raw_separator = | 631 base::string16 raw_separator = |
632 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); | 632 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); |
633 return CreateAttributedString(raw_separator, DimTextColor()); | 633 return CreateAttributedString(raw_separator, DimTextColor()); |
634 } | 634 } |
635 | 635 |
636 @end | 636 @end |
OLD | NEW |