| 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::GetNormalFieldFont(); | 135 return OmniboxViewMac::GetFieldFont(gfx::Font::NORMAL, |
| 136 gfx::Font::Weight::NORMAL); |
| 136 } | 137 } |
| 137 NSFont* BoldFieldFont() { | 138 NSFont* BoldFieldFont() { |
| 138 return OmniboxViewMac::GetBoldFieldFont(); | 139 return OmniboxViewMac::GetFieldFont(gfx::Font::NORMAL, |
| 140 gfx::Font::Weight::BOLD); |
| 139 } | 141 } |
| 140 NSFont* LargeFont() { | 142 NSFont* LargeFont() { |
| 141 return OmniboxViewMac::GetLargeFont(); | 143 return OmniboxViewMac::GetLargeFont(gfx::Font::NORMAL, |
| 144 gfx::Font::Weight::NORMAL); |
| 142 } | 145 } |
| 143 NSFont* LargeSuperscriptFont() { | 146 NSFont* LargeSuperscriptFont() { |
| 144 NSFont* font = OmniboxViewMac::GetLargeFont(); | 147 NSFont* font = OmniboxViewMac::GetLargeFont(gfx::Font::NORMAL, |
| 148 gfx::Font::Weight::NORMAL); |
| 145 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. | 149 // Calculate a slightly smaller font. The ratio here is somewhat arbitrary. |
| 146 // Proportions from 5/9 to 5/7 all look pretty good. | 150 // Proportions from 5/9 to 5/7 all look pretty good. |
| 147 CGFloat size = [font pointSize] * 5.0 / 9.0; | 151 CGFloat size = [font pointSize] * 5.0 / 9.0; |
| 148 NSFontDescriptor* descriptor = [font fontDescriptor]; | 152 NSFontDescriptor* descriptor = [font fontDescriptor]; |
| 149 return [NSFont fontWithDescriptor:descriptor size:size]; | 153 return [NSFont fontWithDescriptor:descriptor size:size]; |
| 150 } | 154 } |
| 151 NSFont* SmallFont() { | 155 NSFont* SmallFont() { |
| 152 return OmniboxViewMac::GetSmallFont(); | 156 return OmniboxViewMac::GetSmallFont(gfx::Font::NORMAL, |
| 157 gfx::Font::Weight::NORMAL); |
| 153 } | 158 } |
| 154 | 159 |
| 155 CGFloat GetContentAreaWidth(NSRect cellFrame) { | 160 CGFloat GetContentAreaWidth(NSRect cellFrame) { |
| 156 return NSWidth(cellFrame) - TextStartOffset(); | 161 return NSWidth(cellFrame) - TextStartOffset(); |
| 157 } | 162 } |
| 158 | 163 |
| 159 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, | 164 NSAttributedString* CreateAnswerStringHelper(const base::string16& text, |
| 160 NSInteger style_type, | 165 NSInteger style_type, |
| 161 bool is_bold, | 166 bool is_bold, |
| 162 BOOL is_dark_theme) { | 167 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; | 720 return base::i18n::IsRTL() ? (inputWidth - glyphOffset) : glyphOffset; |
| 716 } | 721 } |
| 717 | 722 |
| 718 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme { | 723 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme { |
| 719 base::string16 raw_separator = | 724 base::string16 raw_separator = |
| 720 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); | 725 l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR); |
| 721 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); | 726 return CreateAttributedString(raw_separator, DimTextColor(isDarkTheme)); |
| 722 } | 727 } |
| 723 | 728 |
| 724 @end | 729 @end |
| OLD | NEW |