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 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // scope, when the window resigns key the autocomplete popup is | 74 // scope, when the window resigns key the autocomplete popup is |
75 // closed. model() still believes it has focus, and the popup will | 75 // closed. model() still believes it has focus, and the popup will |
76 // be regenerated on the user's next edit. That seems to match how | 76 // be regenerated on the user's next edit. That seems to match how |
77 // things work on other platforms. | 77 // things work on other platforms. |
78 | 78 |
79 namespace { | 79 namespace { |
80 const int kOmniboxLargeFontSizeDelta = 9; | 80 const int kOmniboxLargeFontSizeDelta = 9; |
81 const int kOmniboxNormalFontSizeDelta = 1; | 81 const int kOmniboxNormalFontSizeDelta = 1; |
82 const int kOmniboxSmallMaterialFontSizeDelta = -1; | 82 const int kOmniboxSmallMaterialFontSizeDelta = -1; |
83 | 83 |
84 // TODO(shess): This is ugly, find a better way. Using it right now | |
85 // so that I can crib from gtk and still be able to see that I'm using | |
86 // the same values easily. | |
87 NSColor* ColorWithRGBBytes(int rr, int gg, int bb) { | |
88 DCHECK_LE(rr, 255); | |
89 DCHECK_LE(bb, 255); | |
90 DCHECK_LE(gg, 255); | |
91 return [NSColor colorWithCalibratedRed:static_cast<float>(rr)/255.0 | |
92 green:static_cast<float>(gg)/255.0 | |
93 blue:static_cast<float>(bb)/255.0 | |
94 alpha:1.0]; | |
95 } | |
96 | |
97 NSColor* HostTextColor(bool in_dark_mode) { | 84 NSColor* HostTextColor(bool in_dark_mode) { |
98 return in_dark_mode ? [NSColor whiteColor] : [NSColor blackColor]; | 85 return in_dark_mode ? [NSColor whiteColor] : [NSColor blackColor]; |
99 } | 86 } |
100 NSColor* SecureSchemeColor(bool in_dark_mode) { | 87 NSColor* SecureSchemeColor(bool in_dark_mode) { |
101 return in_dark_mode ? skia::SkColorToSRGBNSColor(SK_ColorWHITE) | 88 return in_dark_mode ? skia::SkColorToSRGBNSColor(SK_ColorWHITE) |
102 : skia::SkColorToSRGBNSColor(gfx::kGoogleGreen700); | 89 : skia::SkColorToSRGBNSColor(gfx::kGoogleGreen700); |
103 } | 90 } |
104 NSColor* SecurityWarningSchemeColor(bool in_dark_mode) { | 91 NSColor* SecurityWarningSchemeColor(bool in_dark_mode) { |
105 return in_dark_mode | 92 return in_dark_mode |
106 ? skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x7F)) | 93 ? skia::SkColorToSRGBNSColor(SkColorSetA(SK_ColorWHITE, 0x7F)) |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 display_text); | 1105 display_text); |
1119 NSDictionary* notification_info = @{ | 1106 NSDictionary* notification_info = @{ |
1120 NSAccessibilityAnnouncementKey : announcement, | 1107 NSAccessibilityAnnouncementKey : announcement, |
1121 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) | 1108 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
1122 }; | 1109 }; |
1123 NSAccessibilityPostNotificationWithUserInfo( | 1110 NSAccessibilityPostNotificationWithUserInfo( |
1124 [field_ window], | 1111 [field_ window], |
1125 NSAccessibilityAnnouncementRequestedNotification, | 1112 NSAccessibilityAnnouncementRequestedNotification, |
1126 notification_info); | 1113 notification_info); |
1127 } | 1114 } |
OLD | NEW |