| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/location_bar/security_state_bubble_decoration.h
" | 5 #import "chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h
" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 [transform translateXBy:x_offset + x_origin_offset | 222 [transform translateXBy:x_offset + x_origin_offset |
| 223 yBy:y_offset + y_origin_offset]; | 223 yBy:y_offset + y_origin_offset]; |
| 224 [transform scaleBy:scale]; | 224 [transform scaleBy:scale]; |
| 225 [transform concat]; | 225 [transform concat]; |
| 226 | 226 |
| 227 // Draw the label. | 227 // Draw the label. |
| 228 [text drawInRect:text_rect]; | 228 [text drawInRect:text_rect]; |
| 229 | 229 |
| 230 // Draw the divider. | 230 // Draw the divider. |
| 231 if (state() == LocationBarDecorationState::NORMAL) { | 231 if (state() == DecorationMouseState::NONE && !active()) { |
| 232 NSBezierPath* line = [NSBezierPath bezierPath]; | 232 NSBezierPath* line = [NSBezierPath bezierPath]; |
| 233 [line setLineWidth:line_width]; | 233 [line setLineWidth:line_width]; |
| 234 [line moveToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), | 234 [line moveToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), |
| 235 NSMinY(decoration_frame))]; | 235 NSMinY(decoration_frame))]; |
| 236 [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), | 236 [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), |
| 237 NSMaxY(decoration_frame))]; | 237 NSMaxY(decoration_frame))]; |
| 238 | 238 |
| 239 NSColor* divider_color = GetDividerColor(in_dark_mode); | 239 NSColor* divider_color = GetDividerColor(in_dark_mode); |
| 240 CGFloat divider_alpha = | 240 CGFloat divider_alpha = |
| 241 [divider_color alphaComponent] * GetAnimationProgress(); | 241 [divider_color alphaComponent] * GetAnimationProgress(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Middle-elide the label to fit |width_left|. This leaves the | 336 // Middle-elide the label to fit |width_left|. This leaves the |
| 337 // prefix and the trailing country code in place. | 337 // prefix and the trailing country code in place. |
| 338 NSString* elided_label = base::SysUTF16ToNSString(gfx::ElideText( | 338 NSString* elided_label = base::SysUTF16ToNSString(gfx::ElideText( |
| 339 base::SysNSStringToUTF16(full_label_), | 339 base::SysNSStringToUTF16(full_label_), |
| 340 gfx::FontList(gfx::Font(GetFont())), width_left, gfx::ELIDE_MIDDLE)); | 340 gfx::FontList(gfx::Font(GetFont())), width_left, gfx::ELIDE_MIDDLE)); |
| 341 | 341 |
| 342 // Use the elided label. | 342 // Use the elided label. |
| 343 SetLabel(elided_label); | 343 SetLabel(elided_label); |
| 344 return GetWidthForImageAndLabel(image, elided_label); | 344 return GetWidthForImageAndLabel(image, elided_label); |
| 345 } | 345 } |
| OLD | NEW |