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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 NSColor* URLTextColor(BOOL is_dark_theme) { | 126 NSColor* URLTextColor(BOOL is_dark_theme) { |
127 if (!ui::MaterialDesignController::IsModeMaterial()) { | 127 if (!ui::MaterialDesignController::IsModeMaterial()) { |
128 return [NSColor colorWithCalibratedRed:0.0 green:0.55 blue:0.0 alpha:1.0]; | 128 return [NSColor colorWithCalibratedRed:0.0 green:0.55 blue:0.0 alpha:1.0]; |
129 } | 129 } |
130 return is_dark_theme ? skia::SkColorToSRGBNSColor(gfx::kGoogleBlue300) | 130 return is_dark_theme ? skia::SkColorToSRGBNSColor(gfx::kGoogleBlue300) |
131 : skia::SkColorToSRGBNSColor(gfx::kGoogleBlue700); | 131 : skia::SkColorToSRGBNSColor(gfx::kGoogleBlue700); |
132 } | 132 } |
133 | 133 |
134 NSFont* FieldFont() { | 134 NSFont* FieldFont() { |
135 return OmniboxViewMac::GetFieldFont(gfx::Font::NORMAL); | 135 return OmniboxViewMac::GetNormalFieldFont(); |
136 } | 136 } |
137 NSFont* BoldFieldFont() { | 137 NSFont* BoldFieldFont() { |
138 return OmniboxViewMac::GetFieldFont(gfx::Font::BOLD); | 138 return OmniboxViewMac::GetBoldFieldFont(); |
139 } | 139 } |
140 NSFont* LargeFont() { | 140 NSFont* LargeFont() { |
141 return OmniboxViewMac::GetLargeFont(gfx::Font::NORMAL); | 141 return OmniboxViewMac::GetLargeFont(); |
142 } | 142 } |
143 NSFont* LargeSuperscriptFont() { | 143 NSFont* LargeSuperscriptFont() { |
144 NSFont* font = OmniboxViewMac::GetLargeFont(gfx::Font::NORMAL); | 144 NSFont* font = OmniboxViewMac::GetLargeFont(); |
145 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. | 145 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. |
146 // Proportions from 5/9 to 5/7 all look pretty good. | 146 // Proportions from 5/9 to 5/7 all look pretty good. |
147 CGFloat size = [font pointSize] * 5.0 / 9.0; | 147 CGFloat size = [font pointSize] * 5.0 / 9.0; |
148 NSFontDescriptor* descriptor = [font fontDescriptor]; | 148 NSFontDescriptor* descriptor = [font fontDescriptor]; |
149 return [NSFont fontWithDescriptor:descriptor size:size]; | 149 return [NSFont fontWithDescriptor:descriptor size:size]; |
150 } | 150 } |
151 NSFont* SmallFont() { | 151 NSFont* SmallFont() { |
152 return OmniboxViewMac::GetSmallFont(gfx::Font::NORMAL); | 152 return OmniboxViewMac::GetSmallFont(); |
153 } | 153 } |
154 | 154 |
155 CGFloat GetContentAreaWidth(NSRect cellFrame) { | 155 CGFloat GetContentAreaWidth(NSRect cellFrame) { |
156 return NSWidth(cellFrame) - TextStartOffset(); | 156 return NSWidth(cellFrame) - TextStartOffset(); |
157 } | 157 } |
158 | 158 |
159 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, | 159 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, |
160 NSInteger style_type, | 160 NSInteger style_type, |
161 bool is_bold, | 161 bool is_bold, |
162 BOOL is_dark_theme) { | 162 BOOL is_dark_theme) { |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; | 715 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; |
716 } | 716 } |
717 | 717 |
718 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme { | 718 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme { |
719 base::string16 raw_separator = | 719 base::string16 raw_separator = |
720 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); | 720 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); |
721 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); | 721 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); |
722 } | 722 } |
723 | 723 |
724 @end | 724 @end |
OLD | NEW |