| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 NSRect focusRingRect = | 414 NSRect focusRingRect = |
| 415 NSInsetRect(frame, singlePixelLineWidth_, singlePixelLineWidth_); | 415 NSInsetRect(frame, singlePixelLineWidth_, singlePixelLineWidth_); |
| 416 path = [NSBezierPath bezierPathWithRoundedRect:focusRingRect | 416 path = [NSBezierPath bezierPathWithRoundedRect:focusRingRect |
| 417 xRadius:kCornerRadius | 417 xRadius:kCornerRadius |
| 418 yRadius:kCornerRadius]; | 418 yRadius:kCornerRadius]; |
| 419 [path setLineWidth:singlePixelLineWidth_ * 2.0]; | 419 [path setLineWidth:singlePixelLineWidth_ * 2.0]; |
| 420 } | 420 } |
| 421 | 421 |
| 422 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; | 422 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; |
| 423 if (isModeMaterial && inDarkMode) { | 423 if (isModeMaterial && inDarkMode) { |
| 424 alphaComponent = 1; | 424 // Special focus color for Material Incognito. |
| 425 [[NSColor colorWithSRGBRed:123 / 255. |
| 426 green:170 / 255. |
| 427 blue:247 / 255. |
| 428 alpha:1] set]; |
| 429 } else { |
| 430 [[[NSColor keyboardFocusIndicatorColor] |
| 431 colorWithAlphaComponent:alphaComponent] set]; |
| 425 } | 432 } |
| 426 [[[NSColor keyboardFocusIndicatorColor] | |
| 427 colorWithAlphaComponent:alphaComponent] set]; | |
| 428 [path stroke]; | 433 [path stroke]; |
| 429 } | 434 } |
| 430 } | 435 } |
| 431 | 436 |
| 432 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 437 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
| 433 std::vector<LocationBarDecoration*> decorations; | 438 std::vector<LocationBarDecoration*> decorations; |
| 434 std::vector<NSRect> decorationFrames; | 439 std::vector<NSRect> decorationFrames; |
| 435 NSRect workingFrame; | 440 NSRect workingFrame; |
| 436 | 441 |
| 437 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, | 442 CalculatePositionsInFrame(cellFrame, leftDecorations_, rightDecorations_, |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 | 779 |
| 775 - (void)handleFocusEvent:(NSEvent*)event | 780 - (void)handleFocusEvent:(NSEvent*)event |
| 776 ofView:(AutocompleteTextField*)controlView { | 781 ofView:(AutocompleteTextField*)controlView { |
| 777 if ([controlView observer]) { | 782 if ([controlView observer]) { |
| 778 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; | 783 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; |
| 779 [controlView observer]->OnSetFocus(controlDown); | 784 [controlView observer]->OnSetFocus(controlDown); |
| 780 } | 785 } |
| 781 } | 786 } |
| 782 | 787 |
| 783 @end | 788 @end |
| OLD | NEW |