| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" | 7 #import "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 NSMinY(decoration_frame))]; | 116 NSMinY(decoration_frame))]; |
| 117 [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), | 117 [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), |
| 118 NSMaxY(decoration_frame))]; | 118 NSMaxY(decoration_frame))]; |
| 119 | 119 |
| 120 bool in_dark_mode = [[control_view window] inIncognitoModeWithSystemTheme]; | 120 bool in_dark_mode = [[control_view window] inIncognitoModeWithSystemTheme]; |
| 121 [GetDividerColor(in_dark_mode) set]; | 121 [GetDividerColor(in_dark_mode) set]; |
| 122 [line stroke]; | 122 [line stroke]; |
| 123 | 123 |
| 124 NSColor* text_color = | 124 NSColor* text_color = |
| 125 in_dark_mode | 125 in_dark_mode |
| 126 ? skia::SkColorToCalibratedNSColor(kMaterialDarkModeTextColor) | 126 ? skia::SkColorToSRGBNSColor(kMaterialDarkModeTextColor) |
| 127 : GetBackgroundBorderColor(); | 127 : GetBackgroundBorderColor(); |
| 128 SetTextColor(text_color); | 128 SetTextColor(text_color); |
| 129 } | 129 } |
| 130 | 130 |
| 131 if (label_) { | 131 if (label_) { |
| 132 NSRect textRect = frame; | 132 NSRect textRect = frame; |
| 133 textRect.origin.x = textOffset; | 133 textRect.origin.x = textOffset; |
| 134 textRect.origin.y += baseline_offset_; | 134 textRect.origin.y += baseline_offset_; |
| 135 textRect.size.width = NSMaxX(decoration_frame) - NSMinX(textRect); | 135 textRect.size.width = NSMaxX(decoration_frame) - NSMinX(textRect); |
| 136 DrawLabel(label_, attributes_, textRect); | 136 DrawLabel(label_, attributes_, textRect); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; | 174 [attributes_ setObject:text_color forKey:NSForegroundColorAttributeName]; |
| 175 } | 175 } |
| 176 | 176 |
| 177 void BubbleDecoration::SetFont(NSFont* font) { | 177 void BubbleDecoration::SetFont(NSFont* font) { |
| 178 [attributes_ setObject:font forKey:NSFontAttributeName]; | 178 [attributes_ setObject:font forKey:NSFontAttributeName]; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void BubbleDecoration::SetBaselineOffset(CGFloat offset) { | 181 void BubbleDecoration::SetBaselineOffset(CGFloat offset) { |
| 182 baseline_offset_ = offset; | 182 baseline_offset_ = offset; |
| 183 } | 183 } |
| OLD | NEW |